By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,689 Members | 1,759 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,689 IT Pros & Developers. It's quick & easy.

Date Range Prompt for a Query

P: n/a
Hello,

I am trying to create a query that will prompt me to enter the
parameter value if beginning date and ending date.
I have created everything I need in the query, but I have to manually
go into SQL view to change the date range. This is what I have so far:

TRANSFORM Count([Program Information].ID) AS CountOfID
SELECT [Program Information].[Client ID], Count([Program
Information].ID) AS [Total Of ID]
FROM [Program Information]
WHERE (((Format([Date In],"Short Date")) Between #2/1/2007# And
#2/28/2007#))
GROUP BY [Program Information].[Client ID]
PIVOT Format([Date In],"Short Date");
Like I said I can get any date range I want by going in here and
changing the dates, but I want it to prompt me to enter the beginning
and end date when I click on the query. I would like to set this up so
others won't have to go into the SQL view and change stuff around. I
am worried that others might accidentally change something they are
not supposed to.

Thanks for any help you can provide.

Mar 11 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 11 Mar 2007 07:54:57 -0700, sixdeuce62 wrote:
Hello,

I am trying to create a query that will prompt me to enter the
parameter value if beginning date and ending date.
I have created everything I need in the query, but I have to manually
go into SQL view to change the date range. This is what I have so far:

TRANSFORM Count([Program Information].ID) AS CountOfID
SELECT [Program Information].[Client ID], Count([Program
Information].ID) AS [Total Of ID]
FROM [Program Information]
WHERE (((Format([Date In],"Short Date")) Between #2/1/2007# And
#2/28/2007#))
GROUP BY [Program Information].[Client ID]
PIVOT Format([Date In],"Short Date");

Like I said I can get any date range I want by going in here and
changing the dates, but I want it to prompt me to enter the beginning
and end date when I click on the query. I would like to set this up so
others won't have to go into the SQL view and change stuff around. I
am worried that others might accidentally change something they are
not supposed to.

Thanks for any help you can provide.
1) Change the query parameter to:
WHERE [Date In] Between [Enter Start Date] And
[Enter End Date]

2) In addition, in a Crosstab query you MUST also enter the parameter
and it's datatype in the Query Parameter dialog box.
In Query Design View, click on Query + Parameters.
Enter:
[Enter Star Date] DateTime
[Enter End Date] DateTime
in their appropriate columns. Include the brackets.

Save and runt the query.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Mar 11 '07 #2

P: n/a
Thanks for the help!!
On Mar 11, 12:00 pm, fredg <fgutk...@example.invalidwrote:
On 11 Mar 2007 07:54:57 -0700, sixdeuce62 wrote:


Hello,
I am trying to create a query that will prompt me to enter the
parameter value if beginning date and ending date.
I have created everything I need in the query, but I have to manually
go into SQL view to change the date range. This is what I have so far:
TRANSFORM Count([Program Information].ID) AS CountOfID
SELECT [Program Information].[Client ID], Count([Program
Information].ID) AS [Total Of ID]
FROM [Program Information]
WHERE (((Format([Date In],"Short Date")) Between #2/1/2007# And
#2/28/2007#))
GROUP BY [Program Information].[Client ID]
PIVOT Format([Date In],"Short Date");
Like I said I can get any date range I want by going in here and
changing the dates, but I want it to prompt me to enter the beginning
and end date when I click on the query. I would like to set this up so
others won't have to go into the SQL view and change stuff around. I
am worried that others might accidentally change something they are
not supposed to.
Thanks for any help you can provide.

1) Change the query parameter to:
WHERE [Date In] Between [Enter Start Date] And
[Enter End Date]

2) In addition, in a Crosstab query you MUST also enter the parameter
and it's datatype in the Query Parameter dialog box.
In Query Design View, click on Query + Parameters.
Enter:
[Enter Star Date] DateTime
[Enter End Date] DateTime
in their appropriate columns. Include the brackets.

Save and runt the query.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -

- Show quoted text -

Mar 18 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.