A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Opening a sub-form from a command button



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2010, 10:01 PM posted to microsoft.public.access.forms
Preston Davis
external usenet poster
 
Posts: 10
Default Opening a sub-form from a command button

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.
--
Preston
  #2  
Old May 28th, 2010, 03:14 AM posted to microsoft.public.access.forms
Lord Kelvan
external usenet poster
 
Posts: 637
Default 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
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:18 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.