If subform dirty, field in main form visible

M

MiataDiablo

On my main form (frmBenefits), I have a subform (subActions) that is
continuous. Either when the the subform receives focus or if the
subform is dirty (I don't care which), I would like a field on the
main form (cboStatus) to become visible.

I've googled and googled and can't find when/where to trigger the
event and the proper syntax. Any help and direction is greatly
appreciated!
 
D

Dirk Goldgar

MiataDiablo said:
On my main form (frmBenefits), I have a subform (subActions) that is
continuous. Either when the the subform receives focus or if the
subform is dirty (I don't care which), I would like a field on the
main form (cboStatus) to become visible.

I've googled and googled and can't find when/where to trigger the
event and the proper syntax. Any help and direction is greatly
appreciated!


For showing the combo box when the subform gets the focus, you could use the
subform *control's* Enter event. I'm talking here about the subform control
on the main form, not any of the controls that are actually on the subform.
Anyway, your code would be something like this:

'------ start of code ------
Private Sub subActions_Enter()

Me.cboStatus.Visible = True

End Sub

Private Sub subActions_Exit()

Me.cboStatus.Visible = False

End Sub
'------ end of code ------

The code for the Exit event is because I assume that you want to hide the
combo when the subform doesn't have the focus.

If you want to wait until the subform becomes dirty, you could use the Dirty
event of the subform's SourceObject form, but you'd also have to use some
event of the main form, maybe the Current event, to hide the combo box
again.
 
M

MiataDiablo

For showing the combo box when the subform gets the focus, you could use the
subform *control's* Enter event.  I'm talking here about the subform control
on the main form, not any of the controls that are actually on the subform.
Anyway, your code would be something like this:

'------ start of code ------
Private Sub subActions_Enter()

    Me.cboStatus.Visible = True

End Sub

Private Sub subActions_Exit()

    Me.cboStatus.Visible = False

End Sub
'------ end of code ------

The code for the Exit event is because I assume that you want to hide the
combo when the subform doesn't have the focus.

If you want to wait until the subform becomes dirty, you could use the Dirty
event of the subform's SourceObject form, but you'd also have to use some
event of the main form, maybe the Current event, to hide the combo box
again.

--
Dirk Goldgar, MS Access MVP
Access tips:www.datagnostics.com/tips.html

(please reply to the newsgroup)

Thank you so much, as usual I was killing a gnat with C4.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top