date format conflict

S

steve mckenna

I have a database that searches for documents by date of
document and date received. If the exact date is not know
I have set up a parameter query that allows the user to
search for dates between and. Both dates are set up s
medium date with a data type of Date/Time. On the
parameter query it accepts dates in any format i.e.
12/07/04 or 12 Jul 04. However on the single date query
it only accepts 12/07/04. I need both these queries to
acept dates input in any format. How do I achieve this,
many thanks in advance
Steve
 
A

Allen Browne

Declare the parameter in your query, so Access knows what type it is.

Open the query in design view.
Choose Parameters on the Query menu.
Enter the exact name of the parameter, and in the 2nd column of the dialog,
specify the Date/Time type.

Internally, Access stores the date/time as a fractional number, where the
whole number represents the date, and the decimal part is the time (fraction
of a day). The way you enter the date/time therefore is not the issue. It is
just a matter of ensuring that Access correctly understands what you enter.

For more clues on how to avoid the 3 cases where Access is likely to
misunderstand your date format, see:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html
 
S

steve mckenna

It doesn't appear to work. The problem I am having is I
want to search for a specfic date in the format e.g. 12
Jun 04 or 12/06/04 where the query accepts both forms of
input. At the moment the criteria is set as Like [Enter
Date] but it only accepts the 12/06/04 format i.e. nothing
is returned if you type 12 Jun 04.
 
S

steve mckenna

It doesn't appear to work. The problem I am having is I
want to search for a specfic date in the format e.g. 12
Jun 04 or 12/06/04 where the query accepts both forms of
input. At the moment the criteria is set as Like [Enter
Date] but it only accepts the 12/06/04 format i.e. nothing
is returned if you type 12 Jun 04.
 
R

Rick Brandt

steve mckenna said:
It doesn't appear to work. The problem I am having is I
want to search for a specfic date in the format e.g. 12
Jun 04 or 12/06/04 where the query accepts both forms of
input. At the moment the criteria is set as Like [Enter
Date] but it only accepts the 12/06/04 format i.e. nothing
is returned if you type 12 Jun 04.

Try CDate([Enter Date])
 
S

Steve McKenna

Rick,

it worked a treat, many thanks
Steve
-----Original Message-----
It doesn't appear to work. The problem I am having is I
want to search for a specfic date in the format e.g. 12
Jun 04 or 12/06/04 where the query accepts both forms of
input. At the moment the criteria is set as Like [Enter
Date] but it only accepts the 12/06/04 format i.e. nothing
is returned if you type 12 Jun 04.

Try CDate([Enter Date])


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.
 

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