Charlotte Foust
cfoust at infostatsystems.com
Fri Oct 5 09:53:03 CDT 2007
Here's a routine I came up with to quickly answer the question of whether any data exists in a record, outside of the key fields. We populate a field with a new record if there are none, but we want to throw it away if they don't enter any data. CurrentRow is a function that returns a datarowview of the current record in a single record form using the binding context. Private Function HasData() As Boolean ' Charlotte Foust 03-Oct-07 Dim blnData As Boolean = False Dim intKeys As Integer = 2 Try Dim flds() As Object = Me.CurrentRow.ItemArray ' skip the PK columns, which are filled by default For i As Integer = intKeys To flds.GetLength(0) - 1 If Not IsDBNull(flds(i)) Then blnData = True Exit For End If Next Catch ex As Exception UIExceptionHandler.ProcessException(ex) End Try Return blnData End Function This is in a subform module, but it could pretty easily be converted to a public function in a shared class. Charlotte Foust