User Prompt for Month to find Date Range

S

sonofroy

I have a query that prompts users to input [Beginning Date] and [Ending
Date]. I have realized that the dates that will be put in are always the
beginning date and the ending date of each month and never change. Is there a
way that I can have the users only input the month and the query will range
the dates for the query?
 
J

John Spencer

If you always want the beginning and end date no matter what date the user
enters you can use this criteria.

Between DateSerial(Year([Enter date in month]),Month([Enter date in month]),1)
and DateSerial(Year([Enter date in month]),Month([Enter date in month])+1,0)

If you always want the month in the current year
[Enter month number]

Between DateSerial(Year(Date()),Month([Enter month number]),1) and
DateSerial(Year(Date()]),Month(CInt[Enter month number])+1,0)

If you always want a specific month and all years for that month, then a
calculated field with criteria should work.

Field: Month([TheDateField])
Criteria: CInt([Enter month number])

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
S

sonofroy

Oh yeah! That does not change either it is alway current year

Jerry Whittle said:
How about the year?
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


sonofroy said:
I have a query that prompts users to input [Beginning Date] and [Ending
Date]. I have realized that the dates that will be put in are always the
beginning date and the ending date of each month and never change. Is there a
way that I can have the users only input the month and the query will range
the dates for the query?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top