date variable: first day of this year?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Trinopus
    New Member
    • Jan 2007
    • 2

    #1

    date variable: first day of this year?

    I can set a date to a given fixed value e.g. date1 = #5/31/1993#

    But how do I set a date to, say, January 1 of the current year, whatever the year happens to be? Obviously, date1 = #1/1/year(today)# doesn't work...but what does?

    Trinopus
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by Trinopus
    I can set a date to a given fixed value e.g. date1 = #5/31/1993#
    But how do I set a date to, say, January 1 of the current year, whatever the year happens to be? Obviously, date1 = #1/1/year(today)# doesn't work...but what does?
    You haven't given us much info on the context where this is being used. But if, for example you are building a query in a string in VB6, you could do this...
    Code:
    "date1 = #1/1/" & year(Now()) & "#"

    Comment

    Working...