Steven Deetz
Registered User.
- Local time
- Today, 00:03
- Joined
- Jul 19, 2001
- Messages
- 49
I have been searching through the forum for a way to create a View that only lists transactions that have occurred in the current month. I was able to create an Access Query that used DateSerial to create the following Criteria under the TransactionDate field:
BETWEEN DateSerial(Year(Date()), Month(Date()), 1) AND
DateSerial(Year(Date()), Month(Date())+1, 0)
When trying this in a View the first error was the Date() function. I replaced the date function with GETDATE(), the Year and Month with DATEPART() to create this function:
When trying this in a View the first error was the Date() function. I replaced the date function with GETDATE(), the Year and Month with DATEPART() to create this function:
BETWEEN DateSerial(DATEPART(yy,GETDATE()),
DATEPART(mm,GETDATE()), 1) AND
DateSerial(DATEPART(yy,GETDATE()),
DATEPART(mm,GETDATE())+1, 0)
But SQL Server then reminded me that DateSerial is not a valid function in SQL Server. Any ideas on creating a way to restrict data in a View to only those transactions occurring in the current month is most appreciated.
But SQL Server then reminded me that DateSerial is not a valid function in SQL Server. Any ideas on creating a way to restrict data in a View to only those transactions occurring in the current month is most appreciated.
