"Expression is typed incorrectly or is too complex..."

J

J. Trucking

Hello,

I have a form which is linked to a query/report. The general idea is
that the user can fill out the form with combo boxes that have been
populated with items in a table, to narrow down a search with a piece
of equipment that crushes rock. The form has two date boxes (start
and end dates), customer box, material box, and location box.
Therefore the user can narrow his/her search on many categories. If I
double click on the query in the database window view, little boxes
come up asking for the values that the query is looking for on the
form. If I manually type them in at this point, the query will run
fine. However, if I use the actual form to input the data, I get a
box that pops up that has the error message "The expression is typed
incorrectly or it is too complex to be evaluated... ". I have read
some other posts and many feel that this could be a reflection in the
way that I set up my date information. On the form, I have set up
text boxes for the user to input the dates. They are set up as "Short
Date" boxes with the input mask 00/00/00. In the query, the following
has been set up to find the dates (I got this from the help of others
on this forum):

Between CDate([Forms]![frmCrusherSearch]![StartDate]) And
CDate([Forms]![frmCrusherSearch]![EndDate])

In the table that stores all of the dates, they are also set up as
"Short Dates"

Can anyone think of any reason why I get this error when I run the
form and not when I manually enter in the data on the query (I think
it's something to do with the dates on the form). Also, while I'm
writing, how would I set up the form so that if the user left one of
the boxes blank, that it would include all of the records for that
entry (ie) if they left the customer box blank, it would include all
of the customers within the criteria of the rest of the boxes (date,
location, etc.).

Thanks in advance for any help,

John
 
G

Guest

Criteria should read, Between Forms![frmCrusherSearch]![StartDate] And
Forms![frmCrusherSearch]![EndDate]
 
J

John W. Vinson

Criteria should read, Between Forms![frmCrusherSearch]![StartDate] And
Forms![frmCrusherSearch]![EndDate]

And you should also copy those criteria into the Query's Parameters box (right
mouseclick the background of the tables and select Parameters), and define
them both as being of Date/Time type.

John W. Vinson [MVP]
 

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