Combo box not populating correctly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a combo box using the SQL query below. For some reason,
the combo box is not showing a list of values for the correct model.
Regardless of the model, it shows the list for the model shown in the first
record. If I copy the SQL to a new query and run it, I type the desired
model when the parameter box pops up and it works fine. I'm using the same
tbl for my query that populates my form as I am for the combo box; could that
be the problem? SQL below. Thank you.

Combo Box:
SELECT Infotbl.part, Infotbl.nhl, Infotbl.model, Infotbl.source
FROM Infotbl
WHERE (((Infotbl.model)=[forms]![infofrm]![txtmodel]) AND
((Infotbl.source)="excela"));


Form's datasource query:
SELECT Infotbl.model, Infotbl.part, Infotbl.nhl, Infotbl.source,
Infotbl.qty, POtbl.buyer, POtbl.supplier, Infotbl.Refpart,
Infotbl.refpartnhl, Infotbl.nhlnhl, Infotbl.status, Infotbl.makebuy,
Infotbl.matl, Infotbl.var, Infotbl.npc, Infotbl.variable
FROM (Infotbl INNER JOIN Model ON Infotbl.model = Model.model) LEFT JOIN
POtbl ON Infotbl.Refpart = POtbl.part
WHERE (((Infotbl.source)="new"));
 
If I understand this correctly, you are using the combo box to show
different values based on another field on the form. If this is correct,
try doing Me.ComboBoxName.Requery in the Form_Current prodcure. That should
update the combo box to have the values that matches the record you are
currently displaying on the form.


Eric Heinold
 
Perfect - thank you so much Eric.

Eric Heinold said:
If I understand this correctly, you are using the combo box to show
different values based on another field on the form. If this is correct,
try doing Me.ComboBoxName.Requery in the Form_Current prodcure. That should
update the combo box to have the values that matches the record you are
currently displaying on the form.


Eric Heinold

Alex said:
I have a form with a combo box using the SQL query below. For some reason,
the combo box is not showing a list of values for the correct model.
Regardless of the model, it shows the list for the model shown in the
first
record. If I copy the SQL to a new query and run it, I type the desired
model when the parameter box pops up and it works fine. I'm using the
same
tbl for my query that populates my form as I am for the combo box; could
that
be the problem? SQL below. Thank you.

Combo Box:
SELECT Infotbl.part, Infotbl.nhl, Infotbl.model, Infotbl.source
FROM Infotbl
WHERE (((Infotbl.model)=[forms]![infofrm]![txtmodel]) AND
((Infotbl.source)="excela"));


Form's datasource query:
SELECT Infotbl.model, Infotbl.part, Infotbl.nhl, Infotbl.source,
Infotbl.qty, POtbl.buyer, POtbl.supplier, Infotbl.Refpart,
Infotbl.refpartnhl, Infotbl.nhlnhl, Infotbl.status, Infotbl.makebuy,
Infotbl.matl, Infotbl.var, Infotbl.npc, Infotbl.variable
FROM (Infotbl INNER JOIN Model ON Infotbl.model = Model.model) LEFT JOIN
POtbl ON Infotbl.Refpart = POtbl.part
WHERE (((Infotbl.source)="new"));
 
Back
Top