Concatenate a string in If statement

ted.martin

Registered User.
Local time
Today, 14:04
Joined
Sep 24, 2004
Messages
743
I have 10 variables in Yes/No check boxes called Media1, Media2, Media3 etc. and I want to use a simple loop to run through them. Unfortunately I can't get the syntax correct and keep getting the Variable not defined error. What I have is:


Dim intLoop as Integer
For intLoop 1 to 10
if ([Media" & intLoop & "] = -1) then
' do something
else
end if
next

Simple I know but I just can't get it right.

Thanks
 
Try

if (Me.Controls("Media" & intLoop) = -1) then

instead.
 
Yep - thats it - thanks for the speedy response.
 

Users who are viewing this thread

Back
Top Bottom