Parameter Query with Between

Walker5

New Member
Joined
Mar 3, 2005
Messages
31
I have a parameter query where I want to get a week's worth of info so I put this in the WHERE clause:

Between [Begin Date] And [Begin Date]+6

Unfortunatley I run into error 3071:
"This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."

Any ideas as to how I can get around this?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
You could *try* giving Access lots of hints with parenthesis, such as:
Between (([Begin Date]) And (([Begin Date])+6))

An alternative syntax:
>=[Begin Date] AND <=([Begin Date] + 6)

Or (more robust in case dates have time portions stored):
>=[Begin Date] AND <([Begin Date] + 7)
 
Upvote 0
Good thinking, I had already tried both of those. I think I just figured it out with this:
Between [Begin Date] And DateAdd("d",6,[Begin Date])
It seems to be working, now I just need to test it.
 
Upvote 0
An afterthought: maybe the original would work if you explicitly define your parameters as dates (under Query | Parameters in Access 2003 and somewhere in the ribbon in Access 2007/2010).
 
Upvote 0
Thanks for your time, Xenou. I couldn't find it in the ribbon (which is not unusual) but I did change the format to "short Date" in the properties box of that field but it still didn't work. Oh, well. Thanks again.
 
Upvote 0
My personal view is you should AVOID parameter prompts for queries and use an INPUT FORM for selecting/using values. There are many reasons but some are

1. You can ensure the correct format is recognized.

2. The user, if they make a mistake, doesn't have to go through all of the prompts again and type it all over.

and there are others but those are the big ones.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,881
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top