View Full Version : Transaction Date


mugman17
05-25-2002, 01:04 PM
I have a query where the user enters the transaction date through a form. It then totals everything given that date. How would I go about having it give totals for the day before the selected date. Pretty simple I'm sure, cant get it to work though. Would it be (transaction date - 1)or something?

Rich
05-25-2002, 01:35 PM
Copy the query re-name it change the criteria as you suggested, you'll have to use DLookup or a subform to display the information.

mugman17
05-25-2002, 01:43 PM
I have tried this before, but I am getting a too complicated error when I use this to get the day before totals under criteria in Transaction Date.

[Forms]![frmDates]![txtStartDate]-1

raskew
05-26-2002, 04:42 AM
Try using the dateadd() function to specify the form date - 1, e.g. (this will work in Northwind 'as is')

SELECT Orders.OrderID, Customers.CompanyName, Orders.OrderDate
FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
WHERE (((Orders.OrderDate)=DateAdd("d",-1,[forms]![DateRange]![From])))
ORDER BY Orders.OrderDate;

mugman17
05-26-2002, 12:26 PM
Thank you, worked great.