Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filtering on a datepart using a between

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm using a DatePart("m",[StartDate]) to filter by month and then filtering further with Between [enter start month ie:1, 2, 3, 10, 11, 12] And [enter end month]. It works fine when both entries are 1 character or both entries are 2 characters. It doesn't work start month is 1 digit and end month is 2 digits.

Thanx in advance.
 

Try this criteria. CInt will convert the parameters to integer values.

Between CInt([enter start month ie:1, 2, 3, 10, 11, 12]) And [enter end month])

You might also want to use the MONTH function rather than datepart. It simplifies things a bit.

Month([StartDate]) Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 

Just noticed that I left off part of the statement in my post.

Between CInt([enter start month ie: 1, 2, 3, 10, 11, 12]) And CInt([enter end month]) Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top