Problem with dates as a parameter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm having the following issue: If I create a function that reads:

IIf([Inc_Date]>=#9/16/2007#,"New","")

the function works properly, regardless of whether [Inc_Date] falls in
September or October (I'm creating this post and running this query on
October 17). However, if I change the function to read:

IIf([Inc_Date]>=[Enter Start Date:],"New","")

and enter 9/16/2007 when prompted, it ONLY returns "New" in the records
where [Inc_Date] is in September; it does NOT return "New" in any records
where [Inc_Date] is in October. Anyone have any idea why this might be
happening?? Please help!!

Thanks,
Eric
 
Eric, you need to declare the parameter, so Access knows the data type.

In query design view, choose Parameters on the Query menu.
Access opens a dialog. Enter:
[Enter Start Date:] Date/Time
 
Great! That did it. Thanks! You learn something new every day...

Eric

Allen Browne said:
Eric, you need to declare the parameter, so Access knows the data type.

In query design view, choose Parameters on the Query menu.
Access opens a dialog. Enter:
[Enter Start Date:] Date/Time

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Eric Stephens said:
I'm having the following issue: If I create a function that reads:

IIf([Inc_Date]>=#9/16/2007#,"New","")

the function works properly, regardless of whether [Inc_Date] falls in
September or October (I'm creating this post and running this query on
October 17). However, if I change the function to read:

IIf([Inc_Date]>=[Enter Start Date:],"New","")

and enter 9/16/2007 when prompted, it ONLY returns "New" in the records
where [Inc_Date] is in September; it does NOT return "New" in any records
where [Inc_Date] is in October. Anyone have any idea why this might be
happening?? Please help!!

Thanks,
Eric
 

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

Back
Top