Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with horrible summary query using a parameter

Status
Not open for further replies.

Paul7905

MIS
Jun 29, 2000
205
US
I have a table with sales records in it, the fields are "Item Number", "Date Sold" (defined as date()) , "Quantity Sold" (defined as number).

I am trying to get a select parameter query to work that will prompt the user for a beginning date and an ending date and then summarize the quantity sold by item number for all items sold from the beginning to ending dates the user supplies.

i coded the query grouping by the Item Number then coded the Quantity Sold to "sum" in the total row.

then i dropped in the Date Sold field and in the total row, coded it as &quot;where&quot;....... then, in the criteria field, I coded >=&quot;DATE1&quot; And <=&quot;DATE2&quot; ~ then i added two expression columns, one with the expression DATE1 and another with the expression DATE2. in the parameters for the query, i coded them both as date/time data types.

when i run the query, as expected, access prompts me for the DATE1 AND DATE2 fields (i enter, for example, 04/10/2001 for the first parameter prompt and 04/17/2001 for the second parameter prompt). I get the following error after i enter the second date ~ &quot;This expression is typed incorrectly or is too complex to evaluate&quot;

i then removed the parameters and coded the criteria on the quantity sold column as follows: >=#04/10/2001# And <=#04/17/2001# and the query worked fine.

Can someone help me to understand what i need to do to get Access to accept the dates as parameters rather than hard coding them into the query??

thanks so much
Paul
 


[red]&quot;... WHERE [datefield]= #&quot; & datevariable & &quot;#&quot;[/red]

has worked for quite some time with dates in Access. Amiel
amielzz@netscape.net

 
For a field that displays dates, you can display the prompts &quot;Type the beginning date:&quot; and &quot;Type the ending date:&quot; to specify a range of values. In the field's date Criteria cell, type the following

Between [Type the beginning date:] And [Type the ending date:]

a form will come on screen asking for the user input of beginning and ending dates for the query. Use this with a select query and your sum field and it should work

cschnable
 
thanks so much ! works great ! what a wonderful place to get help when your stumped !!
Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top