Combo on Main form to filter combo on subform

A

Anne

I created a continuous subform (frmInventorySub) with 2 combo boxes
The first combo is a bound field called GhsSelect and the control Source is
GhseID.
the after update event is is follows
Private Sub GhsSelect_AfterUpdate()
Dim sBenchSource As String
sBenchSource = "SELECT [cboGHSbench].[ghBenchID],
[cboGHSbench].[GHHouseBenchNO],[cboGHSbench].[GhseID]" & _
"FROM cboGHSbench " & _
"WHERE [GhseID] = " & Me.GhsSelect.Value
Me.BenchSelect.RowSource = sBenchSource
Me.BenchSelect.Requery
End Sub

The second combo is call BenchSelect and the control Source is GHBenchID
Row source is:
SELECT [cboGHSbench].[GHBenchID],
[cboGHSbench].[GHHouseBenchNO],[cboGHSbench].[GHSEID]FROM cboGHSbench WHERE
[GhseID] = 2
which combes from the after update event of the first combo.
It works fine.

Now I created a main form (FrmInventory) and made frmInventorySub the
subform. I want to be able to select the greenhouse from a combo on the main
form..
Without making any changes to the subform, when I select one greenhouse from
the combo box on the main form, I loose the benches in my Benchselect combo
on the subform.

I actually should be able to convert the GhsSelect combo to a textbox on the
subform, because it is not needed there anymore. How do I filter the
Benchselect combo on the subform based on the combo on the main form?
Anne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top