Hello,
I have 3 checkboxes on my form that will put "Student", "Teacher", and "Family" into a textbox. If one of the 3 is unchecked, that text in the textbox will be removed. This works great, but unfortunately I am going to need 6 more checkboxes now for 6 different things. For 9 checkboxes, I think this code could get really messy and repetitive. Is there a quicker way or more efficient way of doing this? I'm willing to take the time to write all that code, but I don't want to do it if there's a more efficient way. This is my code for the 3 checkboxes I have:
Code:
Private Sub chkFamily_AfterUpdate()
If chkFamily Then
txtPreFamily = "Family"
Else
txtPreFamily = ""
End If
txtPosition = txtPreTeacher & " " & txtPreStudent & " " & txtPreFamily
End Sub
Private Sub chkStudent_AfterUpdate()
If chkStudent Then
txtPreStudent = "Student"
Else
txtPreStudent = ""
End If
txtPosition = txtPreTeacher & " " & txtPreStudent & " " & txtPreFamily
End Sub
Private Sub chkTeacher_AfterUpdate()
If chkTeacher = True Then
txtPreTeacher = "Teacher"
Else
txtPreTeacher = ""
End If
txtPosition = txtPreTeacher & " " & txtPreStudent & " " & txtPreFamily
End Sub
Thanks for your help.