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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine if field exist

Status
Not open for further replies.

LonnieJohnson

Programmer
Apr 16, 2001
2,628
US
Is there a quicker way to determine if a field exist in a collection other than iterating through the entire collection?

I know how to do...
Code:
For Each fld in rs.Fields
If fld.Name = "MyField" Then
'do something
End if
Next fld
I want to know if you can just say
Code:
If "MyField In rs.Fields Then
'do something
End If

Thanks in advance,

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
A crude way:
On Error Resume Next
strName = rs("MyField").Name
If strName = "MyField" Then
'do something
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top