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

Code for checking one box to fill in 10 others 2

Status
Not open for further replies.

dtecta

Technical User
Joined
Feb 3, 2003
Messages
7
Location
US
Does anyone have a suggestion for a macro or code for a form whereby if the user checks a particular check box to mark a student as having completed the course(CourseCompl), ten other check boxes on the form for attendance will automatically fill in (Module1, Module2,...)

Thanks in advance for an answer to a simple question.
 
Try this in the AfterUpdate of the CheckBox:

If me![CourseCompl] then
me![Module1] = true
me![Module2] = true
. ... .etc
else
'Code goes here for the reverse. If after update the value of CourseCompl is false do you want the other checkboxes set to false or 0.
end if

I assumed from your posting that the other checkboxes were called Module1 thru 10. If not then the names of the controls need to be changed. Bob Scriver
 
In the 'afterupdate' event procedure for your checkbox, add something like:

Private Sub AllComplete_AfterUpdate()
If Me.AllComplete Then
Dim counter As Integer
' change the counter and string to
' match your naming convention
For counter = 1 To 10
Me("Module" & counter) = True
Next counter
End If
End Sub
 
Thank you both for your expert advice... it works like a charm.

Bob - GO STATE! I graduated from MSU in 2000 with my M.A. in Communication. I appreciate your assistance.
 
Hey, Go Spartans

1st time helping another MSU alumni here. Glad I could help. Class of '70. Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top