Opening a sub-form from a command button

  • Thread starter Thread starter Preston Davis
  • Start date Start date
P

Preston Davis

I have a sub-form with in a main form. The sub-form opens with the form. I
want tthe sub-form to open separtely, such as with a command botton.

And if this cannot happen, then I want to delete the sub-form and have the
form (that was the sub-form) to open with a command button, but for it to be
sized to fit with in the area that the sub-form had opened in.

I acually have several sub-forms that open with the main form, each with in
their own page. The the database on the server and with multible users, the
database slows way down.

I want to open each sub-form as needed (instead of as the user moves to
another record). Each form would also need to close as the user moves to an
other form (sub-form), or when moving to the next record.
 
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
 
Back
Top