Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to store the field name that does not exist 1

Status
Not open for further replies.

SweetDot

Technical User
Jan 19, 2004
65
US
I have a lot of fields to retrieve from a database, however, everytime this procedure is run, the tables can be slightly different at times. If there is a field that i'm trying to extract does not exist in the recordset, how can I trap it and store the missing field name somewhere for reporting purposes later? can the operation to continue on?

thanks in advance
 
You can check to see if the fieldname exists in the .Fields collection of the RecordSet. The following loop should get you started on verifying the field's existence.
Code:
For idx1 = 1 To RecSet.Fields.Count
   If RecSet.Fields(idx1 - 1).Name = "MyFieldName" Then
      MsgBox "Field Found"
   End If
Next idx1

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top