Darren DICK
d.dick at uws.edu.au
Thu Oct 23 06:47:10 CDT 2003
Hello all
I have a table called tblOptions Int it are 6 fields each sequentially numbered
MyCriteria1,MyCriteria2,MyCriteria3,MyCriteria4,MyCriteria5,MyCriteria6
I have a form with 6 controls on it called MyControl1, MyControl2,MyControl3 etc.
The form they are on is not bound in any way to the table tblOptions.
So what I wanted to do was a "for next" loop using DlookUp, but I can't get it right. :-(
In psuedo code I want something like...
Dim x, y
For x = 1 To 6
y = DLookup("[MyCriteria & x]", "tblOptions", "[OptionID] = 1")
Me.MyControl" & x = y
Next
Of course this doesn't work and I know I could do soemthing like
Me.MyControl1 = DLookup("[MyCriteria1]", "tblOptions", "[OptionID] = 1")
Me.MyControl2 = DLookup("[MyCriteria2]", "tblOptions", "[OptionID] = 1")
Me.MyControl3 = DLookup("[MyCriteria3]", "tblOptions", "[OptionID] = 1")
etc but I wanted something neater
Many thanks in advance
Darren