combo box question

foxy

Registered User.
Local time
Today, 10:35
Joined
Feb 17, 2009
Messages
64
Hi,

I have a couple of combo boxes on an unbound form.

One of the combo boxes just displays a list of everything in one field in a table.

I then want the rows available to select in the second box to be filtered by what was selected in the first box.

This is the row source I have for the second box at the minute:

Code:
SELECT tblSource_Group.SG_name
FROM tblRAO INNER JOIN tblSource_Group ON tblRAO.RAO_ID = tblSource_Group.RAO_ID
WHERE tblSource_Group.RAO_ID = (select tblRAO.RAO_ID 
                                  from tblRAO 
                                  where tblRAO.RAO_name = txtRAO);

I dont seem to be able to reference back to the contents of the first combo box.

Any ideas?
 
from the look of yr sql you dont need to link to tblRAO as you are using RAO_ID to link and then to filter too, i'm assuming that RAO_ID is a numeric field and txtRAO is the first combo box, in this case use the following on the afterupdate event of txtRAO


me.secondCombo.recordsource="SELECT tblSource_Group.SG_name FROM tblSource_Group WHERE tblSource_Group.RAO_ID = " & txtRAO ";"
me.secondCombo.requery


if RAO_ID is a text field then use the following:
me.secondCombo.recordsource="SELECT tblSource_Group.SG_name FROM tblSource_Group WHERE tblSource_Group.RAO_ID = '" & txtRAO "';"
me.secondCombo.requery
 

Users who are viewing this thread

Back
Top Bottom