Query Date Range

  • Thread starter Thread starter karenfocus
  • Start date Start date
K

karenfocus

How can I use Between/And to prompt for date range that includes the start
and end date?
 
Hi,

Design a select query for your table.
add all fields to the design grid.
In criteria box of the date field write this
Between #BeginningDate# And #EndingDate#
and run the query to find results.

JB
 
My current criteria is in a query date field and is written
Between [Enter start date] And [Enter end date]
but when I run the query from the first day of the month to the last it does
not include the first or last day of the month. Any suggestions much
appreciated,
Karenfocus
 
How can I use Between/And to prompt for date range that includes the start
and end date?

Between already includes the start and end date.


In the criteria of the query say:

between [Enter the Starting Date] and [Enter the Ending Date]

Ron
 
On Mon, 3 Dec 2007 05:10:00 -0800, karenfocus

.... where SomeDateField between [Give start date:] and [Give end
date:]

-Tom.
 
You sure it's not including the first day?

If the date field also includes time, it makes sense that it wouldn't
include the last day. However, that's easily fixed by changing your query to

Between [Enter start date] And DateAdd("d", 1, [Enter end date])

or, if you're a purist

Between [Enter start date] And DateAdd("s", 86399, [Enter end date])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


karenfocus said:
My current criteria is in a query date field and is written
Between [Enter start date] And [Enter end date]
but when I run the query from the first day of the month to the last it
does
not include the first or last day of the month. Any suggestions much
appreciated,
Karenfocus

Jahanzaib said:
Hi,

Design a select query for your table.
add all fields to the design grid.
In criteria box of the date field write this
Between #BeginningDate# And #EndingDate#
and run the query to find results.

JB
 
Sorry, it does include the first day and time. Tried your suggestion and it
worked a treat. I spent hours and hours trying to get this so all I can say
is a very big thank you!

Douglas J. Steele said:
You sure it's not including the first day?

If the date field also includes time, it makes sense that it wouldn't
include the last day. However, that's easily fixed by changing your query to

Between [Enter start date] And DateAdd("d", 1, [Enter end date])

or, if you're a purist

Between [Enter start date] And DateAdd("s", 86399, [Enter end date])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


karenfocus said:
My current criteria is in a query date field and is written
Between [Enter start date] And [Enter end date]
but when I run the query from the first day of the month to the last it
does
not include the first or last day of the month. Any suggestions much
appreciated,
Karenfocus

Jahanzaib said:
Hi,

Design a select query for your table.
add all fields to the design grid.
In criteria box of the date field write this
Between #BeginningDate# And #EndingDate#
and run the query to find results.

JB
:

How can I use Between/And to prompt for date range that includes the
start
and end date?
 
This is very interesting. If I may, please tell me how to incorporate this
code with the following:

Private Sub LastName_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = Me.LastName
stDocName = "frmProjectStaffingDetails"
DoCmd.OpenForm stDocName, , , "LastName = " & stLinkCriteria

End Sub

My objective is to have the user double click on the LastName and a form
pops up to display the information pertaining to that name in a specific time
frame.

Help is greatly appreciated.
Thanks
--
tmdrake


Douglas J. Steele said:
You sure it's not including the first day?

If the date field also includes time, it makes sense that it wouldn't
include the last day. However, that's easily fixed by changing your query to

Between [Enter start date] And DateAdd("d", 1, [Enter end date])

or, if you're a purist

Between [Enter start date] And DateAdd("s", 86399, [Enter end date])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


karenfocus said:
My current criteria is in a query date field and is written
Between [Enter start date] And [Enter end date]
but when I run the query from the first day of the month to the last it
does
not include the first or last day of the month. Any suggestions much
appreciated,
Karenfocus

Jahanzaib said:
Hi,

Design a select query for your table.
add all fields to the design grid.
In criteria box of the date field write this
Between #BeginningDate# And #EndingDate#
and run the query to find results.

JB
:

How can I use Between/And to prompt for date range that includes the
start
and end date?
 
karenfocus had a query with

Between [Enter start date] And [Enter end date]

as the criteria for a date field in the underlying table(s).

You can do the same thing, basing your frmProjectStaffingDetails form on
that query instead of whatever it's currently based.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


tmdrake said:
This is very interesting. If I may, please tell me how to incorporate
this
code with the following:

Private Sub LastName_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = Me.LastName
stDocName = "frmProjectStaffingDetails"
DoCmd.OpenForm stDocName, , , "LastName = " & stLinkCriteria

End Sub

My objective is to have the user double click on the LastName and a form
pops up to display the information pertaining to that name in a specific
time
frame.

Help is greatly appreciated.
Thanks
--
tmdrake


Douglas J. Steele said:
You sure it's not including the first day?

If the date field also includes time, it makes sense that it wouldn't
include the last day. However, that's easily fixed by changing your query
to

Between [Enter start date] And DateAdd("d", 1, [Enter end date])

or, if you're a purist

Between [Enter start date] And DateAdd("s", 86399, [Enter end date])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


karenfocus said:
My current criteria is in a query date field and is written
Between [Enter start date] And [Enter end date]
but when I run the query from the first day of the month to the last it
does
not include the first or last day of the month. Any suggestions much
appreciated,
Karenfocus

:

Hi,

Design a select query for your table.
add all fields to the design grid.
In criteria box of the date field write this
Between #BeginningDate# And #EndingDate#
and run the query to find results.

JB
:

How can I use Between/And to prompt for date range that includes the
start
and end date?
 

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

Back
Top