I feel like I'm going crazy here. I've tried everything I can think of and nothing seems to work. I have a checkbox CRShtnvsp
and if checked, I have vba to enable additional checkboxes. This checkbox is actually enabled/disabled via another checkbox itself CRShtn
. And that sequence works perfectly well. I just can't seem to get the vba for CRShtnvsp
to enable additional checkboxes to work. Please help! VBA for both CRShtnvsp
and CRShtn
below.
This code works perfectly well:
Private Sub CRShtn_AfterUpdate()
If CRShtn = True Then
CRShtnvsp.Enabled = True
Else
CRShtnvsp.Enabled = False
End if
End Sub
This code does not work:
Private Sub CRShtnvsp_AfterUpdate()
If CRShtnvsp = True Then
CRShtn_vaso_phen.Enabled = True
Else
CRShtn_vaso_phen.Enabled = False
End if
End Sub
What's happening here?
All checkboxes are set to Enabled = No in the property sheet so that they are disabled until prior checkboxes or comboboxes on my form are changed using AfterUpdate() or Form_Current().
CodePudding user response:
Sometimes Access seems to lose track of an event procedure. I don't know why that happens, but if that's your situation, you can remind Access the procedure exists.
Go to the Event tab on the property sheet for your CRShtnvsp
checkbox. In the "After Update" property box, make sure "[Event Procedure]" is selected and then press the button labelled with 3 dots. You should be at your existing procedure. And I think that should be enough to remind Access it exists.
CodePudding user response:
CRShtnvsp is not updating as it's not being used - I would try adding the code for enabling the next button under the original button you're using and see if that works. To clarify: Add the code for enabling CRShtn_vaso_phen under the CRShtn_AfterUpdate sub.