Opening a sub-form from a command button
why dont you use normal forms and open then forms from command buttons
having the properity on the form modal set to yes. this means they
will have to close down that form before they can do anything else.
i supose if you want to do this you could try this
you need to have a blank subform to replace the other subforms when
they open
and on your subform controls use the blank subform as the sourceobject
YOU CANNOT NOT SET THE SOURCEOBJECT TO NOTHING OR "" WHICH IS WHY YOU
NEED THE BLANK SUBFORM
Private Sub showsubform1button_Click()
frmsubform2.SourceObject = "frmblanksubform"
frmsubform.SourceObject = "frmsubform"
[Forms]![frmmainform]![frmsubform].SetFocus
End Sub
Private Sub showsubform2button_Click()
frmsubform.SourceObject = "frmblanksubform"
frmsubform2.SourceObject = "frmsubform2"
[Forms]![frmmainform]![frmsubform].SetFocus
End Sub
i cannot get a lostfocus thing to work but you coudl try to target the
change of record as then set all the subforms to the blank subform.
Hope this helps
Regards
Kelvan
|