Compile error after DB Split in queries

L

lovespar

Hi,
I created some test DB's for test data by copying and relinking the FE and
BE of an existing DB that is having problems. My queries are giving me
a"compile error" when I try to open them. The error is in the Criteria which
is just a date expression
=DateAdd("d",-3,Date()) And <=Date()+1. If I enter this expression in design veiw, when I reopen the query in design view again, I get the error and the criteria is gone.
What can I do to get this test DB going?

Thanks
 
A

Allen Browne

Okay, so you have code in the database that does not compile.

You need to fix the code. When it refuses to compile, it will point out the
line that cannot be understood. Fix it, and repeat until the database
compiles okay.
 
L

lovespar

Here is the message. I don't understand how to fix it.
Compile error. in query expression '((([Weekly Contractor
Injuries].WeekEndDate)>=(DateAdd("d",-3,Date()) and (Wkly Contatctor
Injuries].WeekEndDate)<=Date()+1))'
When I use Alt-F11 to find any code, the lnly objects listed are forms and
subforms, no queries.
Thanks for looking at this.
 
J

John W. Vinson

Here is the message. I don't understand how to fix it.
Compile error. in query expression '((([Weekly Contractor
Injuries].WeekEndDate)>=(DateAdd("d",-3,Date()) and (Wkly Contatctor <<<--
Injuries].WeekEndDate)<=Date()+1))'
When I use Alt-F11 to find any code, the lnly objects listed are forms and
subforms, no queries.
Thanks for looking at this.

You're missing an opening square bracket and have misspelled Contractor on the
marked line.


John W. Vinson [MVP]
 
L

lovespar

I am a lousy typer, I tried to do a paste and copy and couldn't.
Do you see any other reason why this statement would not make a connection
between the query and the combo box on the form?

John W. Vinson said:
Here is the message. I don't understand how to fix it.
Compile error. in query expression '((([Weekly Contractor
Injuries].WeekEndDate)>=(DateAdd("d",-3,Date()) and (Wkly Contatctor <<<--
Injuries].WeekEndDate)<=Date()+1))'
When I use Alt-F11 to find any code, the lnly objects listed are forms and
subforms, no queries.
Thanks for looking at this.

You're missing an opening square bracket and have misspelled Contractor on the
marked line.


John W. Vinson [MVP]
 
J

John W. Vinson

I am a lousy typer, I tried to do a paste and copy and couldn't.
Do you see any other reason why this statement would not make a connection
between the query and the combo box on the form?

Your statement doesn't make any reference to any form!

The syntax to do so is

[Forms]![NameOfTheForm]![NameOfTheControl]

and the brackets are required. Just naming a control in a Query will not work,
because the Query has no indication what forms are meant - there might be
several forms open, or none at all.

John W. Vinson [MVP]
 
Top