Combobox Query not working

  • Thread starter Thread starter SueM
  • Start date Start date
S

SueM

Hi,

I have a combobox query that isn't working for me and I
can't figure out why.

I've tried the following:
Basing the combobox query on a query which is based on 2
tables which have a 1 to many relationship. The query
itself works, but when I try to narrow down results to
only those for the selected product in the previous
combobox no values are returned. Could this be because the
table on the many side of the query contains 2 primary
keys?

I've also tried basing the query on the tables themselves
which also returns the correct values, but also returns no
values when I try to narrow it down to only those values
for the selected product in the previous combobox.

The queries are as follows:
Based on Query:
SELECT MeasureQ.No, MeasureQ.Measure FROM MeasureQ WHERE
(((MeasureQ.No)=[FDM1]));

Basedon tables:
SELECT FOODDES.No, WEIGHT.GmWgt FROM FOODDES INNER JOIN
WEIGHT ON FOODDES.No = WEIGHT.No WHERE (((FOODDES.No)=
[FDM1]));

MeasureQ=the query
FDM1= the previous combobox
FOODDES= one of the tables (1 side on 1 to many based on
FOODDES.No)
WEIGHT= other table & many side of one to many.
Contains 2 primary keys
WEIGHT.GmWgt= that value I want showing in the new combo
FOODDES.No & WEIGHT.No= the primary fields that have a
relationship.

Any ideas what I am doing wrong? Or on a better way to
achieve this?

Cheers,

Sue
 
SELECT MeasureQ.No, MeasureQ.Measure FROM MeasureQ WHERE
(((MeasureQ.No)=[FDM1]));

You can't reference a combo box without specifying the form:

Try

WHERE [MeasureQ].[No] = [Forms]![yourformname]![FDM]

Also, Requery the combo box in the AfterUpdate event of the FDM combo.
 
Back
Top