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

problem getting values from checkboxes on form 1

Status
Not open for further replies.

qwjels

Technical User
May 25, 2003
2
0
0
NL
Hello there,

I'm pretty new user with vba in access. My problem is that i can't get the values from checkboxes on my form. I want to use a for each loop by the controls on my form. My code's like this:
dim ctl as control

for each ctl in me.controls
if ctl = checkbox then
...bladiebla
end if next does someone no a better way or can help me out? thanx
 
Hi I have just created a form and added a bunch of diffent controls to it and then named each control V1 V2 V3 ETC so that every control was simply named.
I then added the following VB code to one button


Private Sub Val7_Click()
Dim ctl As Control
For Each ctl In Controls
MsgBox "The name of the control is " + ctl.Name
Next ctl
End Sub

Saving the form and then clicking on the test button resulted in a MSGBOX printout of the name of each control.
Thus it should be easy to replace the message box with an
IF-Then-End If testing for the name that particularly interests you.
I hope that helps
Cheers
Graham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top