Reputation: 25
I'm working with an access database for school and I'm trying to figure out how to pull all of the transactions from the current day without having to manually change the date range. My current query is:
SELECT COUNT (CustID) AS [Number of Transactions]
FROM [Transaction]
WHERE Date=_____
So is there a way to have access pull the date from the machine and use that?
Thanks in advance!
Upvotes: 1
Views: 4542
Reputation: 31
Use date() function in your where clause. That will give you the current date results. i.e. Where [Date] = date()
Upvotes: 1
Reputation: 15875
The Getdate() equivalent in access is Now().
if you format the date column as a short date, then format now as a short date, they will be equivalent.
SELECT COUNT (CustID) AS [Number of Transactions]
FROM [Transaction]
WHERE format (date, "short date") = format(now(), "short date")
Upvotes: 1