Need Help with VBA Date Coding

MarkA70

Registered User.
Local time
Today, 11:26
Joined
Jan 30, 2016
Messages
43
I work on a database for a non Profit that runs two events a year. These events take place in December of year 20XX and April of year 20XX +1. I am trying to write the code for a query that will have the date criteria such that it is like

#12/1/20XX# to #5/1/20XX+1# to cover both events.

I can of course hard code that but looking for programatic solution that takes the value of NOW() and creates the both of the dates for the date range for the query.
 
Make use of DateSerial() & Year() functions.

so something like;
Code:
Between DateSerial(Year(Date()),12,1) And DateSerial(Year(Date())+1,5,1)
 
you want the date function rather than the now function

you also need to clarify exactly what you mean - what happens when you get to January next year - do you still want the december event of this year and april event of next year? or do you want april event of next year and december event of next year?
 

Users who are viewing this thread

Back
Top Bottom