M
mlkiser via AccessMonster.com
I am working on some checklists (7 versions to be exact). Each of these
checklists has a butt load of checkboxes. They are set up in pairs. For each
pair, only one of the checkboxes can (well, currently, should) be checked. So,
if you check one, the other should uncheck, and vice-versa. I can do it with
code, it is fairly simple. Here is a sample of one checkbox in one pair on
one checklist:
Private Sub Check_250w_1_AfterUpdate()
If Me!Check_250w_1 Then
Me!Check_250w_2 = False
cl_250w_2 = 0
End If
End Sub
If they check box Check_250w_1, then check box Check_250w_1 will uncheck and
the corresponding table value (cl_250w_2) is set to zero.
Now, like I said, there are a ton of these check box pairs. What I would like
to do is basically write this like a SAS macro such that, when a box is
checked or unchecked, the check box name is passed to the macro. That way,
one piece of code like that above would work for every checkbox. I want it to
look something like:
Private Sub Checkbox_AfterUpdate(strCheckBox)
If Me!strCheckBox_1 Then
Me!strCheckBox_2 = False
End If
End Sub
I am assuming this has to be a module so that I can call it. But how do I
reference the current checkbox name? For instance, I know the statement:
strFrom=me.form.name
would give me the name of the form in the var strFrom. But can you refer to a
checkbox name in the same way? Something like me.form.checkbox? I know that
doesn’t work, I tried. But I am wondering if there is a way to refer to the
name of the checkbox in that manner?
checklists has a butt load of checkboxes. They are set up in pairs. For each
pair, only one of the checkboxes can (well, currently, should) be checked. So,
if you check one, the other should uncheck, and vice-versa. I can do it with
code, it is fairly simple. Here is a sample of one checkbox in one pair on
one checklist:
Private Sub Check_250w_1_AfterUpdate()
If Me!Check_250w_1 Then
Me!Check_250w_2 = False
cl_250w_2 = 0
End If
End Sub
If they check box Check_250w_1, then check box Check_250w_1 will uncheck and
the corresponding table value (cl_250w_2) is set to zero.
Now, like I said, there are a ton of these check box pairs. What I would like
to do is basically write this like a SAS macro such that, when a box is
checked or unchecked, the check box name is passed to the macro. That way,
one piece of code like that above would work for every checkbox. I want it to
look something like:
Private Sub Checkbox_AfterUpdate(strCheckBox)
If Me!strCheckBox_1 Then
Me!strCheckBox_2 = False
End If
End Sub
I am assuming this has to be a module so that I can call it. But how do I
reference the current checkbox name? For instance, I know the statement:
strFrom=me.form.name
would give me the name of the form in the var strFrom. But can you refer to a
checkbox name in the same way? Something like me.form.checkbox? I know that
doesn’t work, I tried. But I am wondering if there is a way to refer to the
name of the checkbox in that manner?