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 / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

cascade combobox with one combobox in a subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
deb - 21 Jan 2008 20:42 GMT
I have a form with a subform.
The formfPerfEmissionGua) has a field called FuelClass.
(Gas,Liquid,Duel,Multi)
The subform(fPerfEmissionGuaDetails)is based off of a table called tFuel
with the fields...
FuelID --  GasLiquid -- FuelName
1    --      Gas  --      Propane
2    --      Gas  --      Buthane
3    --      Liquid  --   JetA
4    --      Liquid  --   Crude

The subform is used as a dropdown choice of the above fields. It is a
contiguous form.

I would like to be able to choose the FuelClass - Gas in the main form, and
the sub form drop down only show the fuels for Gas only (Propane and Buthane).
If the FuelClass is Multi or Dual, show all choices.

Thanks in advance
deb
Tom van Stiphout - 22 Jan 2008 02:37 GMT
Perhaps it's worth reviewing the recent discussion on this subject
here:
http://groups.google.com/group/microsoft.public.access/browse_thread/thread/59d5
bb6e128ac265/28853dfa0034300f?lnk=st&q=#28853dfa0034300f


-Tom.

>I have a form with a subform.
>The formfPerfEmissionGua) has a field called FuelClass.
[quoted text clipped - 16 lines]
>Thanks in advance
>deb
NetworkTrade - 23 Jan 2008 00:20 GMT
your title and your description seem slightly different however I think the
key for you is that the first combobox is the criteria for a query...

and the subform (or 2nd combobox) is sourced on that query...

in the query design you need to reference that first combobox in the criteria:
Forms!FormName.Combobox

keep in mind that the combobox value is the bound column, which is not what
you visually see in many cases....

when it comes to 'dual' or 'multi' - - that is going to be dependent on how
you structure your tables and data so a search will work;

Signature

NTC

> I have a form with a subform.
> The formfPerfEmissionGua) has a field called FuelClass.
[quoted text clipped - 16 lines]
> Thanks in advance
> deb
Ken Sheridan - 23 Jan 2008 01:42 GMT
I assume that if the FuelClass is Liquid you'd also want to restrict the
combo box to those fuels whose GasLiquid column is 'Liquid'.  For the
RowSource property of the subform's combo box reference the FuelClass control
on the parent form:

SELECT FuelID, FuelName
FROM tFuel
WHERE GasLiquid = Parent.FuelClass
OR Parent.FuelClass IN("Multi", "Dual")
OR Parent.FuelClass IS NULL;

Note that you can reference the parent form by means of the Parent property;
you don't have to reference it by name.  You could of course also include the
GasLiquid column in the SELECT clause if you want it to show in a
multi-column drop down list for the combo box.  FuelID would normally be a
hidden bound column.  I've allowed for the FuelClass in the parent form being
unspecified, i.e Null, but if that's not legitimate remove the final 'OR
Parent.FuelClass IS NULL' from the SQL statement.

In the parent form's Current event procedure, and in the AfterUpdate event
procedure of the FuelClass control on the parent form requery the subform's
combo box, referencing it via the Form property of the subform control:

Me.YourSubformControl.Form.YourComboBox.Requery

where YourSubformControl is the name of the control in the parent form which
houses the subform, not its underlying form object (unless both have the same
name of course), and YourComboBox is the name of the combo box in the subform.

On thing to be aware of here is that all rows in the subform would have to
be of the same fuel class if Gas or Liquid are selected as the parent form's
FuelClass.  Selecting a class in the parent form will restrict the combo
boxes in all rows in the subform, so if for instance there are already rows
of class 'Gas' and 'Liquid' is selected in the parent form, the controls in
the subform's rows will go blank.  The underlying data in the subform's table
won't change as the values will still be the hidden FuelID values, but you
won't see the corresponding names.

Ken Sheridan
Stafford, England

> I have a form with a subform.
> The formfPerfEmissionGua) has a field called FuelClass.
[quoted text clipped - 16 lines]
> Thanks in advance
> deb
Ken Sheridan - 23 Jan 2008 01:49 GMT
I assume that if the FuelClass is Liquid you'd also want to restrict the
combo box to those fuels whose GasLiquid column is 'Liquid'.  For the
RowSource property of the subform's combo box reference the FuelClass control
on the parent form:

SELECT FuelID, FuelName
FROM tFuel
WHERE GasLiquid = Parent.FuelClass
OR Parent.FuelClass IN("Multi", "Dual")
OR Parent.FuelClass IS NULL;

Note that you can reference the parent form by means of the Parent property;
you don't have to reference it by name.  You could of course also include the
GasLiquid column in the SELECT clause if you want it to show in a
multi-column drop down list for the combo box.  FuelID would normally be a
hidden bound column.  I've allowed for the FuelClass in the parent form being
unspecified, i.e Null, but if that's not legitimate remove the final 'OR
Parent.FuelClass IS NULL' from the SQL statement.

In the parent form's Current event procedure, and in the AfterUpdate event
procedure of the FuelClass control on the parent form requery the subform's
combo box, referencing it via the Form property of the subform control:

Me.YourSubformControl.Form.YourComboBox.Requery

where YourSubformControl is the name of the control in the parent form which
houses the subform, not its underlying form object (unless both have the same
name of course), and YourComboBox is the name of the combo box in the subform.

On thing to be aware of here is that all rows in the subform would have to
be of the same fuel class if Gas or Liquid are selected as the parent form's
FuelClass.  Selecting a class in the parent form will restrict the combo
boxes in all rows in the subform, so if for instance there are already rows
of class 'Gas' and 'Liquid' is selected in the parent form, the controls in
the subform's rows will go blank.  The underlying data in the subform's table
won't change as the values will still be the hidden FuelID values, but you
won't see the corresponding names.

Ken Sheridan
Stafford, England

> I have a form with a subform.
> The formfPerfEmissionGua) has a field called FuelClass.
[quoted text clipped - 16 lines]
> Thanks in advance
> deb

> I have a form with a subform.
> The formfPerfEmissionGua) has a field called FuelClass.
[quoted text clipped - 16 lines]
> Thanks in advance
> deb
Ken Sheridan - 23 Jan 2008 01:49 GMT
I assume that if the FuelClass is Liquid you'd also want to restrict the
combo box to those fuels whose GasLiquid column is 'Liquid'.  For the
RowSource property of the subform's combo box reference the FuelClass control
on the parent form:

SELECT FuelID, FuelName
FROM tFuel
WHERE GasLiquid = Parent.FuelClass
OR Parent.FuelClass IN("Multi", "Dual")
OR Parent.FuelClass IS NULL;

Note that you can reference the parent form by means of the Parent property;
you don't have to reference it by name.  You could of course also include the
GasLiquid column in the SELECT clause if you want it to show in a
multi-column drop down list for the combo box.  FuelID would normally be a
hidden bound column.  I've allowed for the FuelClass in the parent form being
unspecified, i.e Null, but if that's not legitimate remove the final 'OR
Parent.FuelClass IS NULL' from the SQL statement.

In the parent form's Current event procedure, and in the AfterUpdate event
procedure of the FuelClass control on the parent form requery the subform's
combo box, referencing it via the Form property of the subform control:

Me.YourSubformControl.Form.YourComboBox.Requery

where YourSubformControl is the name of the control in the parent form which
houses the subform, not its underlying form object (unless both have the same
name of course), and YourComboBox is the name of the combo box in the subform.

On thing to be aware of here is that all rows in the subform would have to
be of the same fuel class if Gas or Liquid are selected as the parent form's
FuelClass.  Selecting a class in the parent form will restrict the combo
boxes in all rows in the subform, so if for instance there are already rows
of class 'Gas' and 'Liquid' is selected in the parent form, the controls in
the subform's rows will go blank.  The underlying data in the subform's table
won't change as the values will still be the hidden FuelID values, but you
won't see the corresponding names.

Ken Sheridan
Stafford, England

> I have a form with a subform.
> The formfPerfEmissionGua) has a field called FuelClass.
[quoted text clipped - 16 lines]
> Thanks in advance
> deb

> I have a form with a subform.
> The formfPerfEmissionGua) has a field called FuelClass.
[quoted text clipped - 16 lines]
> Thanks in advance
> deb
Ken Sheridan - 23 Jan 2008 01:50 GMT
I assume that if the FuelClass is Liquid you'd also want to restrict the
combo box to those fuels whose GasLiquid column is 'Liquid'.  For the
RowSource property of the subform's combo box reference the FuelClass control
on the parent form:

SELECT FuelID, FuelName
FROM tFuel
WHERE GasLiquid = Parent.FuelClass
OR Parent.FuelClass IN("Multi", "Dual")
OR Parent.FuelClass IS NULL;

Note that you can reference the parent form by means of the Parent property;
you don't have to reference it by name.  You could of course also include the
GasLiquid column in the SELECT clause if you want it to show in a
multi-column drop down list for the combo box.  FuelID would normally be a
hidden bound column.  I've allowed for the FuelClass in the parent form being
unspecified, i.e Null, but if that's not legitimate remove the final 'OR
Parent.FuelClass IS NULL' from the SQL statement.

In the parent form's Current event procedure, and in the AfterUpdate event
procedure of the FuelClass control on the parent form requery the subform's
combo box, referencing it via the Form property of the subform control:

Me.YourSubformControl.Form.YourComboBox.Requery

where YourSubformControl is the name of the control in the parent form which
houses the subform, not its underlying form object (unless both have the same
name of course), and YourComboBox is the name of the combo box in the subform.

On thing to be aware of here is that all rows in the subform would have to
be of the same fuel class if Gas or Liquid are selected as the parent form's
FuelClass.  Selecting a class in the parent form will restrict the combo
boxes in all rows in the subform, so if for instance there are already rows
of class 'Gas' and 'Liquid' is selected in the parent form, the controls in
the subform's rows will go blank.  The underlying data in the subform's table
won't change as the values will still be the hidden FuelID values, but you
won't see the corresponding names.

Ken Sheridan
Stafford, England

> I have a form with a subform.
> The formfPerfEmissionGua) has a field called FuelClass.
[quoted text clipped - 16 lines]
> Thanks in advance
> deb

> I have a form with a subform.
> The formfPerfEmissionGua) has a field called FuelClass.
[quoted text clipped - 16 lines]
> Thanks in advance
> deb
Ken Sheridan - 23 Jan 2008 01:52 GMT
I assume that if the FuelClass is Liquid you'd also want to restrict the
combo box to those fuels whose GasLiquid column is 'Liquid'.  For the
RowSource property of the subform's combo box reference the FuelClass control
on the parent form:

SELECT FuelID, FuelName
FROM tFuel
WHERE GasLiquid = Parent.FuelClass
OR Parent.FuelClass IN("Multi", "Dual")
OR Parent.FuelClass IS NULL;

Note that you can reference the parent form by means of the Parent property;
you don't have to reference it by name.  You could of course also include the
GasLiquid column in the SELECT clause if you want it to show in a
multi-column drop down list for the combo box.  FuelID would normally be a
hidden bound column.

In the parent form's Current event procedure, and in the AfterUpdate event
procedure of the FuelClass control on the parent form requery the subform's
combo box, referencing it via the Form property of the subform control:

Me.YourSubformControl.Form.YourComboBox.Requery

where YourSubformControl is the name of the control in the parent form which
houses the subform, not its underlying form object (unless both have the same
name of course), and YourComboBox is the name of the combo box in the subform.

On thing to be aware of here is that all rows in the subform would have to
be of the same fuel class if Gas or Liquid are selected as the parent form's
FuelClass.  Selecting a class in the parent form will restrict the combo
boxes in all rows in the subform, so if for instance there are already rows
of class 'Gas' and 'Liquid' is selected in the parent form, the controls in
the subform's rows will go blank.  The underlying data in the subform's table
won't change as the values will still be the hidden FuelID values, but you
won't see the corresponding names.

Ken Sheridan
Stafford, England

> I have a form with a subform.
> The formfPerfEmissionGua) has a field called FuelClass.
[quoted text clipped - 16 lines]
> Thanks in advance
> deb
 
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



©2009 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.