Hi,
I have a small conundrum relating to the visible display of a field on one of my forms. This form is used for editing previously saved records.
I have a check box, which when checked I want a field to then become visible so that I can enter data into it. My two fields are called:
SUB_ASSY (the checkbox) and SUB_ASSY_REF (the field I need to control).
For entry I used this code:
Private SUB_ASSY_AfterUpdate()
If Me.SUB_ASSY = True Then
Me.SUB_ASSY_REF.Visible = True
Else
ME.SUB_ASSY_REF.Visible = False
End If
End Sub
This works but I don't just want to do this for entry purposes. If I then use the NEXT button and go to the next record, records that do not have the SUB_ASSY checkbox checked are shown on the screen but still show the SUB_ASSY_REF field as visible. When you go NEXT is the AfterUpdate code for the field ignored? I would have thought that since the record is fetched, the checkbox is updated with the new data for the next record so that code would work.
I'm assuming that since you physically did not click the checkbox, it doesn't work. In fact on any of these newly found records if I check and then un-check the box, the field does disappear as I would expect.
So, the code is ok - but only on "activating" the check box manually.
How can I show the NEXT database record with the field suppressed if the checkbox entry is FALSE and have it visible if the checkbox entry is TRUE for each newly found record? This must be something simple but it would seem that I can't see the wood for the trees on this one!
I tried adding a "BeforeUpdate" version of the code above (that seemed to make sense logically as surely this should run before you actually check the box) but that doesn't work. I guess I need to run this code when the record is found and displayed. I feel that I'm being a complete dummy here...
And oh yes... I'm new at this...
Comments please?
I have a small conundrum relating to the visible display of a field on one of my forms. This form is used for editing previously saved records.
I have a check box, which when checked I want a field to then become visible so that I can enter data into it. My two fields are called:
SUB_ASSY (the checkbox) and SUB_ASSY_REF (the field I need to control).
For entry I used this code:
Private SUB_ASSY_AfterUpdate()
If Me.SUB_ASSY = True Then
Me.SUB_ASSY_REF.Visible = True
Else
ME.SUB_ASSY_REF.Visible = False
End If
End Sub
This works but I don't just want to do this for entry purposes. If I then use the NEXT button and go to the next record, records that do not have the SUB_ASSY checkbox checked are shown on the screen but still show the SUB_ASSY_REF field as visible. When you go NEXT is the AfterUpdate code for the field ignored? I would have thought that since the record is fetched, the checkbox is updated with the new data for the next record so that code would work.
I'm assuming that since you physically did not click the checkbox, it doesn't work. In fact on any of these newly found records if I check and then un-check the box, the field does disappear as I would expect.
So, the code is ok - but only on "activating" the check box manually.
How can I show the NEXT database record with the field suppressed if the checkbox entry is FALSE and have it visible if the checkbox entry is TRUE for each newly found record? This must be something simple but it would seem that I can't see the wood for the trees on this one!
I tried adding a "BeforeUpdate" version of the code above (that seemed to make sense logically as surely this should run before you actually check the box) but that doesn't work. I guess I need to run this code when the record is found and displayed. I feel that I'm being a complete dummy here...
And oh yes... I'm new at this...
Comments please?