G
Guest
I have a parent/master form with several subforms (under tabs). When I
change a check box in one subform, I want the controls in another subform to
show or hide according to program code that looks something like this:
If Forms![HSPCA]![PetInfo].Form!PetType = "Dog" Then
Me.HWT.Visible = True
Me.CatFIVFeleukCombo.Visible = False
End If
Some of you who assisted me before (see 2/8 entries) advised me to put this
type of code in the Current event of the form with the controls that I want
to show/hide. I did this and it works...once. The Current event--as I
understand it--works when you first open a subform or when you have gone from
one record to another but, after that, if you change a checkbox in one
subform and then go to another subform the Current event does not trigger.
I've read and reread the online guidance (including 'Order of events for
database objects') and it seems to state that one can trigger the Current
event with a requery or refresh statement. I tried the refresh (Me.refresh)
and it didn't seem to do anything when located either in the Current event or
when placed in the OnFocus of a form control. The requery (Me.Requery)
'does' work but there's about a 5 second delay and a lot of 'jiggling' as,
apparently, the database requeries 2,000 or so records. The Activate event
looked like a likely contender but it apparently doesn't work in a subform.
I tried docmd.gotocontrol "<control name>" but that didn't do the trick
either. Once in the form that I want to show/hide controls on, if I simply
tab from control to control it will, at some point, trigger the Current event
changes that I wanted to see when I clicked on the subform's tab. Yep, I've
spent the better part of today experimenting....
My question, then, is: Is there a way other than the Requery method to force
the
Current event to take place? Alternatively, is there a better approach that
can be suggested (e.g., programmatically move forward one record and back to
trigger the Current event)?
Thanks in advance...for your patience and insight.
change a check box in one subform, I want the controls in another subform to
show or hide according to program code that looks something like this:
If Forms![HSPCA]![PetInfo].Form!PetType = "Dog" Then
Me.HWT.Visible = True
Me.CatFIVFeleukCombo.Visible = False
End If
Some of you who assisted me before (see 2/8 entries) advised me to put this
type of code in the Current event of the form with the controls that I want
to show/hide. I did this and it works...once. The Current event--as I
understand it--works when you first open a subform or when you have gone from
one record to another but, after that, if you change a checkbox in one
subform and then go to another subform the Current event does not trigger.
I've read and reread the online guidance (including 'Order of events for
database objects') and it seems to state that one can trigger the Current
event with a requery or refresh statement. I tried the refresh (Me.refresh)
and it didn't seem to do anything when located either in the Current event or
when placed in the OnFocus of a form control. The requery (Me.Requery)
'does' work but there's about a 5 second delay and a lot of 'jiggling' as,
apparently, the database requeries 2,000 or so records. The Activate event
looked like a likely contender but it apparently doesn't work in a subform.
I tried docmd.gotocontrol "<control name>" but that didn't do the trick
either. Once in the form that I want to show/hide controls on, if I simply
tab from control to control it will, at some point, trigger the Current event
changes that I wanted to see when I clicked on the subform's tab. Yep, I've
spent the better part of today experimenting....
My question, then, is: Is there a way other than the Requery method to force
the
Current event to take place? Alternatively, is there a better approach that
can be suggested (e.g., programmatically move forward one record and back to
trigger the Current event)?
Thanks in advance...for your patience and insight.