|
Question : VBA Loop through record names
|
|
I've got a database that contains the fields IN1, IN2, IN3, IN4, IN5, IN6, IN7, IN8, IN9 and IN10.
I don't want to write the same code 10 times so I would like to just concatenate the number on to IN and loop through 10 times to check it.
like this:
for i = 1 to 10 If Not IsNull(records![IN & i]) Then MsgBox "Valid Number" End If next i
but i'm not sure of the syntax to accomplish this or if it's possible.
Thanks
|
|
Answer : VBA Loop through record names
|
|
my bust,... sorry
dim i as variant
change this: If Not IsNull(records![IN & i]) Then
to: If Not IsNull(records("IN" & i) Then
|
|
|
|