[RESOLVED] Detecting missing RS fields
Hope you guys have had coffee :)
I have a control that you pass a recordset to to fill. Other designers using this control may miss the creation of one of the fields or a malformed RS arrives at the control.
How can I detect the number of fields or their field names that is being passed with out a terminal error?
Re: Detecting missing RS fields
This should give you some ideas. The code does assume that the current record is the first record.
VB Code:
Dim lngTotalFields as Long
Dim oFields as ADODB.Fields
If Not rs Is Nothing Then
If rs.State = adStateOpen Then
lngTotalFields = rs.Fields.Count
For Each oField in Fields
'Do something
Next
If Not (rs.EOF And rs.BOF) Then
Do Until rs.EOF
'Do Something
rs.MoveNext
Loop
End If
End If
Re: Detecting missing RS fields
LOL. I JUST finished writing a piece of code that does just that.
Thanks!