I have a form with 3 contacts (Contacts 1, 2, & 3). Each contact has a name, address, and phone number. Above each contact, I have a check box to indicate if it should be used or not.
I would like to have one section of code to load this form when I pull it up, instead of loading contact 1, then 2, then 3.
The code below is what I found. What I want it to do is for i = 1 to 3, if the contact is not active, set visible to False. What am I not doing right.
for i = 1 to 3
if me.Controls("contact" & i.tostring & "_active") = true then
me.Controls("contact" & i.tostring & "_name").visible = false
me.Controls("contact" & i.tostring & "_city").visible = false
me.Controls("contact" & i.tostring & "_state").visible = false
me.Controls("contact" & i.tostring & "_phone").visible = false
end if
next i