How to prompt user input parameters for SQL Queries in Access 2010
- by user1848907
SELECT Transactions.TransactionNumber
FROM Transactions
WHERE (((Transactions.Date)>=#11/23/12#)) AND (((Transactions.Date)<=#11/23/12#));
The above code returns all the transaction that happened between the specified dates. But I want those dates to be defined by the user every time the query is executed.
I tried using the [] operators to have the user define the criteria in the WHERE, something like this:
WHERE (((Transactions.Date)>=[Input a Date])) AND (((Transactions.Date)<=[Input a Date]));
But microsoft Access throws a Syntax error message. The same happens when I include the # (date operators) like this
WHERE (((Transactions.Date)>=#[Input a Date]#)) AND (((Transactions.Date)<=#[Input a Date]#));
Is there anopther way to manage dates that I'm not aware of or is asking a user for dates in a query out of the question