April 13, 2007 at 2:43 pm
Greetings all! I'm new to writing SQL reports so I apologize in advance if this is a beginners question.
I'm writing a report where I've selected records based on a datetime colum using:
select closedate from
I've defaulted the @end value to be "=Now" and that yields what I expect it to (the current date and time), but I cannot figure out how to define the @begin parameter to always default to 1/1 of the current year. Can anyone point me in the right direction for this? I'd like these to be default values so I can schedule them to run automatically and I think hard coding this in the SQL statement would just be silly.
Many thanks in advance!
-Sam
April 13, 2007 at 6:26 pm
Hi Sam,
Here's a snippet of code I've used in the past for just such a situation:
=cdate(Month(Today) & "/01/" & Year(Today))
this would use the current month and year so 04/01/2007
what you want is:
=cdate( "01/01/" & Year(Today)) and that should do the trick.
Give it a try and let me know the results.
-hawkeyeboy
April 16, 2007 at 7:59 am
Perfect! That was exactly what I was looking for. Many thanks!
-Sam
April 16, 2007 at 8:33 am
No problem Sam. Glad it worked.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply