Access 2007 and Dates

F

Fev

Hi
I have a parameter query to display upcoming birthdays, however I seem
to be getting inconsistent results. I have never had this problem in
older versions of Access. My parameter queries are:
Between [Enter Start day as a number] And [Enter End day as a number]
for the expression:
myDay: DatePart("d",[DateOfBirth])
[Enter the month as a number] for the expression myMonth: DatePart("m",
[DateOfBirth])

I have 2 birthdays listed in January. 07 Jan 1956 and 01 Jan 1985
When I enter the following parameters: between 1 and 9 (for the days)
and 1 for the month, both birthdays appear.
However, when I enter between 1 and 15 (for the days) and 1 for the
month, only the 01 Jan birthday appears. This appears when I mix
single and double digit numbers for the days, but I have tried
including leading 0's without success. I am also getting other
inconsistencies for other birthdays. I have re-inputted the DOB's. I
am running Windows XP, with the short date format set to dd/MM/yyyy.

Thanks - any suggestions would be greatly appreciated
Heather
 
A

Allen Browne

The issue suggests that Access may be treating the parameters as text
instead of numbers. You may be able to fix this by declaring the parameters
so Access knows they are numbers.

In query design view, choose Parameters on the Query menu.
Enter 3 rows in the dialog like this:
[Enter Start day as a number] Long
[Enter End day as a number] Long
[Enter the month as a number] Long

Post back if that doesn't fix it.
 

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