Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

conditional choice of subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
george - 03 Mar 2005 14:11 GMT
Hi to all,

I have a main form with a combo box and a tab control on
it.

On pg3 of the tab control there is a subform. What I would
like to do is to have a different subform appear on pg3
depending on the value of the combo box on the main form.

Example: if the value for the combo box is "Automobile" I
would like the fsubAutomobile to appear on pg3 whereas if
the value for the combo box is "Bicycle" I would like the
fsubBicycle to appear on pg3 of the tab control.

(Note: the two subforms share different info and different
number of fields, it would not suit me to just change the
rowsource for the same subform)

Is this possible?
AlCamp - 03 Mar 2005 14:42 GMT
Yes it is.
On the AfterUpdate of your main form combo, you can apply a different query
to the RecordSource of the subform.

Check out Record Source Property/Examples in Help, and it will show you how
to apply a query/SQL statement to a subform.  Then just use an IF to decide
which query/SQL to apply.
hth
Al Camp

> Hi to all,
>
[quoted text clipped - 15 lines]
>
> Is this possible?
george - 03 Mar 2005 15:54 GMT
Al,
thanks for the reply. I don't really understand this. What
about the subform's design? If fsubAutomobile has a
different look than fsubBicycle, where are their different
designs stored in the solution that you propose? I thought
I should already have  the different subforms made and
then somehow manage to substitute one for the other
programmatilly with conditional expressions

>-----Original Message-----
>Yes it is.
[quoted text clipped - 28 lines]
>
>.
John Nurick - 03 Mar 2005 20:42 GMT
Hi George,

You should be able to do this by manipulating the SourceObject and
perhaps also the LinkChildFields and LinkMasterFields properties of the
subform control on the tab page. A subform is merely a form that has
been opened in a subform control, and the SourceObject property of the
subform control determines which form it opens.

An alternative approach would be to have two subform controls on the
tab, and make one or the other visible as needed.

>Hi to all,
>
[quoted text clipped - 15 lines]
>
>Is this possible?

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.