query is perfect in immediate mode, doesn't work in combo box

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

Guest

Here is my query:

SELECT tbldayemps.empno, tbldayemps.crewno, tbldayemps.logday
FROM tbldayemps
WHERE (((tbldayemps.crewno)=0) AND
((tbldayemps.logday)=[forms]![dailylog].[form]![cbotdate]));

If use a break point and stop the form, it gives the result I want, but the
combo box comes up with no results. The field I am using in the where clause
is in the main form, the combo box running the query is in a nested subform.
 
SandyR said:
Here is my query:

SELECT tbldayemps.empno, tbldayemps.crewno, tbldayemps.logday
FROM tbldayemps
WHERE (((tbldayemps.crewno)=0) AND
((tbldayemps.logday)=[forms]![dailylog].[form]![cbotdate]));

If use a break point and stop the form, it gives the result I want, but
the
combo box comes up with no results. The field I am using in the where
clause
is in the main form, the combo box running the query is in a nested
subform.

Is it possible that when the subform loads, it loads with a record in the
main form that does not result in any records for that query? Try
requerying the combobox on Form.current.

HTH;

Amy
 
Thanks for replying!

I am pretty sure that the record in the main form has results, but I will
try your suggestion. Which form's current event am I putting the requery
into? the main form, the intermediate subform, or the subform with the combo?

Amy Blankenship said:
SandyR said:
Here is my query:

SELECT tbldayemps.empno, tbldayemps.crewno, tbldayemps.logday
FROM tbldayemps
WHERE (((tbldayemps.crewno)=0) AND
((tbldayemps.logday)=[forms]![dailylog].[form]![cbotdate]));

If use a break point and stop the form, it gives the result I want, but
the
combo box comes up with no results. The field I am using in the where
clause
is in the main form, the combo box running the query is in a nested
subform.

Is it possible that when the subform loads, it loads with a record in the
main form that does not result in any records for that query? Try
requerying the combobox on Form.current.

HTH;

Amy
 
Thanks again for your reply - I found the problem - the query was working
fine - I was displaying the wrong column of the combo box.

Your suggestion did help me to figure this out!

Amy Blankenship said:
SandyR said:
Here is my query:

SELECT tbldayemps.empno, tbldayemps.crewno, tbldayemps.logday
FROM tbldayemps
WHERE (((tbldayemps.crewno)=0) AND
((tbldayemps.logday)=[forms]![dailylog].[form]![cbotdate]));

If use a break point and stop the form, it gives the result I want, but
the
combo box comes up with no results. The field I am using in the where
clause
is in the main form, the combo box running the query is in a nested
subform.

Is it possible that when the subform loads, it loads with a record in the
main form that does not result in any records for that query? Try
requerying the combobox on Form.current.

HTH;

Amy
 
Back
Top