Parameter Query SQL and Date Ranges

D

D. Stacy

The below query asks the user to enter the date and then it returns a list of
hours for that particular day. My objective is to convert this query so that
it ask the user to enter a range of dates (begin D and end D) and have it
return the list of hours for all the hours between the two dates.
I’m having trouble with the correct syntax for the PARAMETERS section.

PARAMETERS EnterTheDate DateTime;
SELECT EnterTheDate+TimeSerial([Num_Hrs],0,0) AS time_
FROM TblHrsPerDay;
 
M

MGFoster

D. Stacy said:
The below query asks the user to enter the date and then it returns a list of
hours for that particular day. My objective is to convert this query so that
it ask the user to enter a range of dates (begin D and end D) and have it
return the list of hours for all the hours between the two dates.
I’m having trouble with the correct syntax for the PARAMETERS section.

PARAMETERS EnterTheDate DateTime;
SELECT EnterTheDate+TimeSerial([Num_Hrs],0,0) AS time_
FROM TblHrsPerDay;

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If you just want to know the number of hours between two dates you do
not need a query, you can use the DateDiff() function:

DateDiff("h", [Begin Date], [End Date])

Substitute #real dates# or date variables for [Begin Date] and [End
Date].

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBShP5vYechKqOuFEgEQL2UgCfd+gVsDPjVp0c7cHN7jjsFSw4Q40AnizP
AeH7rYrohuIAGPqCace0Bo3m
=ITBg
-----END PGP SIGNATURE-----
 
B

bhicks11 via AccessMonster.com

Use this in the criteria:

Between [Enter start date] and [Enter end date]

Bonnie
http://www.dataplus-svc.com

D. Stacy said:
The below query asks the user to enter the date and then it returns a list of
hours for that particular day. My objective is to convert this query so that
it ask the user to enter a range of dates (begin D and end D) and have it
return the list of hours for all the hours between the two dates.
I’m having trouble with the correct syntax for the PARAMETERS section.

PARAMETERS EnterTheDate DateTime;
SELECT EnterTheDate+TimeSerial([Num_Hrs],0,0) AS time_
FROM TblHrsPerDay;
 
B

bhicks11 via AccessMonster.com

Or this:
= CDate([Enter start date:]) AND < DateAdd("d", 1, CDate([Enter end date:]))

Bonnie
Use this in the criteria:

Between [Enter start date] and [Enter end date]

Bonnie
http://www.dataplus-svc.com
The below query asks the user to enter the date and then it returns a list of
hours for that particular day. My objective is to convert this query so that
[quoted text clipped - 5 lines]
SELECT EnterTheDate+TimeSerial([Num_Hrs],0,0) AS time_
FROM TblHrsPerDay;
 

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