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

S

SandyR

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.
 
A

Amy Blankenship

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
 
S

SandyR

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
 
S

SandyR

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
 

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