hi,
im having a problem in getting the sales based on a date range given by a user.. pls help me provide the code.. tnx
Printable View
hi,
im having a problem in getting the sales based on a date range given by a user.. pls help me provide the code.. tnx
The Query should similar to this:
SELECT YourDateField.YourTable FROM YourTable WHERE
YourDateField.YourTable > #10/10/2006# AND YourDateField.YourTable < #1/2/2007#;
Note1: the date notation is in US style -> Month,Day,Year
Note2: A date should be surrounded by # in a SQL query to be regognized as such
Note3: The code to extract this query from your Access database depends on the type of connection you want to make DOA, ADO and if you want to use a datacontrol or not to bind a form/controle to this data.
Additionally would it not be safer to use BETWEEN instead of > or <. Further are we not to use
format("10/10/2006",desiredformat)
to ensure safer working with databases.
correct me if I am wrong.
"SELECT * FROM ORDERS WHERE orderDate BETWEEN #" & format("10/10/2006","yyyy/mm/dd") & "# AND #" & format("1/2/2007","yyyy/mm/dd") & "#"
thanks pips.. :)