Problems with qureies and VBA

J

Jvanleuvan

I have a qurey saved in an access DB. in the SQL code for the qurery it
references back to a text box on a form. when the form is open a user will
input a date into this text box. The qurey then get reciepts for that date.

HERE'S THE PROBLEM: If the form is open and the text box is filled out. I
can go to the database window and open a report based on the query just fine.
However if i put a button on the form that runs the VBA command
"docmd.openreport" I get an error syaing the "expression is too complex" -in
reference to the SQL

Now if I Debug the code (thus pausing execution) and go to the database
window and open the query, it's blank (no records) if I then STOP the code
and open the qurey it now has records! The code for the button Literally
just reads docmd.openreport ("my_report")

Not sure why this happens. The code should't have anything to do with the
qurey other than opening it...

Thanks for any help...
 
Top