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

Determine current field in ado recordset - how?

Status
Not open for further replies.

MikeBronner

Programmer
May 9, 2001
756
US
I would like a statement that returns the index or name of the current field in a recordset.

I have tried things similar to the following, but to no avail:

adoset.fields.index

Any suggestions? Best Regards and many Thanks!
Michael G. Bronner X-)

"Open your mind, and the rest will follow."
 
To access an index property of a collection, the collection must be coded to support it. As far as I know, the fields collection does not.

That leaves you with the option of setting a manual counter and counting each step as you take it.

I suggest you avoid using code to make decisions based on the index of fields and records, as these can change when you change the query, or sortorder or whatever.

Good Luck!
-Mats Hulten
 
Any ideas how I can solve my dilema? I am attaching the recordset to a datarepeater, so the type of records and such is always the same.

I wan't to be able to determine which field the user is currently editing.

I wouldn't think this would be so difficult? :) Best Regards and many Thanks!
Michael G. Bronner X-)

"Open your mind, and the rest will follow."
 
Code:
Dim oFld as Variant
Dim i as Integer

1 = 0

For Each oFld in ors.Fields
   i = i + 1
   Debug.print oFld.Name 'Recommended
   Debug.print i
Next
-Mats
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top