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  

Exploratory question!



 
 
Thread Tools Display Modes
  #1  
Old December 7th, 2006, 02:41 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default Exploratory question!


Is it possible to change the subform content depending on a different button
clicked in the main form?

--
How many buildings collapsed on 9/11?

I can tell you the answer isn't 2 !!
  #2  
Old December 7th, 2006, 02:53 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Exploratory question!

Care to elaborate? Change the subform content how? Have a different
recordsource?

Me!SubformControlName.Form.RecordSource = "SELECT Field1, Field2...."

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"scubadiver" wrote in message
...

Is it possible to change the subform content depending on a different
button
clicked in the main form?

--
How many buildings collapsed on 9/11?

I can tell you the answer isn't 2 !!



  #3  
Old December 7th, 2006, 02:55 PM posted to microsoft.public.access.forms
Joan Wild
external usenet poster
 
Posts: 642
Default Exploratory question!

Sure. You can change the recordsource of the subform, or the SourceObject.
You can also have two subforms, and just hide/display whichever one you
like.

--
Joan Wild
Microsoft Access MVP

scubadiver wrote:
Is it possible to change the subform content depending on a different
button clicked in the main form?

--
How many buildings collapsed on 9/11?

I can tell you the answer isn't 2 !!



  #4  
Old December 7th, 2006, 03:10 PM posted to microsoft.public.access.forms
Keith Wilby
external usenet poster
 
Posts: 812
Default Exploratory question!

"scubadiver" wrote in message
...

Is it possible to change the subform content depending on a different
button
clicked in the main form?


Yes.

Keith.
www.keithwilby.com


  #5  
Old December 7th, 2006, 03:19 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default Exploratory question!

Sorry. When i meant "content" I meant the form itself.

I am thinking of a fancy main switch board menu. I have three buttons and I
want each button to select a different form to put into the subform.

Cheers!


--
How many buildings collapsed on 9/11?

I can tell you the answer isn''t 2 !!


"Douglas J. Steele" wrote:

Care to elaborate? Change the subform content how? Have a different
recordsource?

Me!SubformControlName.Form.RecordSource = "SELECT Field1, Field2...."

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"scubadiver" wrote in message
...

Is it possible to change the subform content depending on a different
button
clicked in the main form?

--
How many buildings collapsed on 9/11?

I can tell you the answer isn't 2 !!




  #6  
Old December 7th, 2006, 03:20 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default Exploratory question!

I want more than one subform and display one depending on which button I
click on the main form.

Can you explain how. It might be useful :-)


"Joan Wild" wrote:

Sure. You can change the recordsource of the subform, or the SourceObject.
You can also have two subforms, and just hide/display whichever one you
like.

--
Joan Wild
Microsoft Access MVP

scubadiver wrote:
Is it possible to change the subform content depending on a different
button clicked in the main form?

--
How many buildings collapsed on 9/11?

I can tell you the answer isn't 2 !!




  #7  
Old December 7th, 2006, 03:27 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Exploratory question!

Depending on the exact set up, you should be able to change the SourceObject
property of the subform control:

If Me.MyCheckbox = True Then
Me!SubformControlName.SourceObject = "sfrmChoice1"
Else
Me!SubformControlName.SourceObject = "sfrmChoice2"
End If

Don't forget that this might involve changing the LinkChildFields and
LinkMasterFields properties as well.

Or, as Joan suggested, you can simply have two separate subform controls,
placed one on top of the other, and decide which one to make visible:

If Me.MyCheckbox = True Then
Me!SubformControlName1.Visible = True
Me!SubformControlName2.Visible = False
Else
Me!SubformControlName1.Visible = False
Me!SubformControlName2.Visible = True
End If

In the form's Open event, you might even put code like:

Me!SubformControlName1.Top = Me!SubformControlName2.Top
Me!SubformControlName1.Left = Me!SubformControlName2.Left

to guarantee that they're exactly one on top of the other.


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"scubadiver" wrote in message
...
Sorry. When i meant "content" I meant the form itself.

I am thinking of a fancy main switch board menu. I have three buttons and
I
want each button to select a different form to put into the subform.

Cheers!


--
How many buildings collapsed on 9/11?

I can tell you the answer isn''t 2 !!


"Douglas J. Steele" wrote:

Care to elaborate? Change the subform content how? Have a different
recordsource?

Me!SubformControlName.Form.RecordSource = "SELECT Field1, Field2...."

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"scubadiver" wrote in message
...

Is it possible to change the subform content depending on a different
button
clicked in the main form?

--
How many buildings collapsed on 9/11?

I can tell you the answer isn't 2 !!






  #8  
Old December 7th, 2006, 03:29 PM posted to microsoft.public.access.forms
Joan Wild
external usenet poster
 
Posts: 642
Default Exploratory question!

Set the visible property of the subform controls to false. In your code you
would set the visible property of the subform control to true.

Check out the samples in Help.


--
Joan Wild
Microsoft Access MVP

scubadiver wrote:
I want more than one subform and display one depending on which
button I click on the main form.

Can you explain how. It might be useful :-)


"Joan Wild" wrote:

Sure. You can change the recordsource of the subform, or the
SourceObject. You can also have two subforms, and just hide/display
whichever one you like.

--
Joan Wild
Microsoft Access MVP

scubadiver wrote:
Is it possible to change the subform content depending on a
different button clicked in the main form?

--
How many buildings collapsed on 9/11?

I can tell you the answer isn't 2 !!



  #9  
Old December 8th, 2006, 04:56 AM posted to microsoft.public.access.forms
John Vinson
external usenet poster
 
Posts: 4,033
Default Exploratory question!

"scubadiver" wrote:


Is it possible to change the subform content depending on a different button
clicked in the main form?


Yet another way to do it is to create a Tab Control with three pages, one
subform on each; and set the tab control's Style to Button rather than Tab.

  #10  
Old December 8th, 2006, 11:09 AM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default Exploratory question!


Thanks Joan,

I am working on it.

"Joan Wild" wrote:

Set the visible property of the subform controls to false. In your code you
would set the visible property of the subform control to true.

Check out the samples in Help.


--
Joan Wild
Microsoft Access MVP

scubadiver wrote:
I want more than one subform and display one depending on which
button I click on the main form.

Can you explain how. It might be useful :-)


"Joan Wild" wrote:

Sure. You can change the recordsource of the subform, or the
SourceObject. You can also have two subforms, and just hide/display
whichever one you like.

--
Joan Wild
Microsoft Access MVP

scubadiver wrote:
Is it possible to change the subform content depending on a
different button clicked in the main form?

--
How many buildings collapsed on 9/11?

I can tell you the answer isn't 2 !!




 




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 05:54 PM.


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