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

replace Me.field1 with Me.field(i)

Status
Not open for further replies.

Wrathchild

Technical User
Aug 24, 2001
303
US
Hi, how do I replace Me.field1, Me.field2, Me.field3, etc. with Me.field(i) in a loop so I don't have to write out fifteen of these? I can't get the syntax correct.

thanks
 
I very much doubt you can - the way to loop through collections is to use the For Each...Next construct

for each fld in Tablename.Fields
msgbox fld.name
next

Rgds, Geoff
Si hoc legere scis, nimis eruditionis habes
Want the best answers to your questions ? - then read me baby one more time - faq222-2244
 
ok, but how would I set this up, currently I have:

with rst
.addnew
!record1 = Me.field1
!record2 = Me.field2
!record3 = Me.field3
etc.

how do I apply a counter to both the rst and field names?
I've figured out the field name part (search for certain common name in field name) but compiler doesn't like !record(i)

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top