Query Date Range

K

karenfocus

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

Jahanzaib

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
 
K

karenfocus

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
 
R

Ron2006

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
 
T

Tom van Stiphout

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

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

-Tom.
 
D

Douglas J. Steele

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
 
K

karenfocus

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?
 
T

tmdrake

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?
 
D

Douglas J. Steele

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?
 
Top