Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Help

Status
Not open for further replies.

ksorrell

Programmer
Joined
Jul 29, 2005
Messages
9
Location
US
Hi all,
I am still kind of new at this...

I am trying to have a date parameter that the user selects a month and it
brings back all the data for that month. Say the users picks August, the
report comes back for all the data for the month of August.

I hope I explained it well enough.

Any help would be great.
Thanks in advance,
Kerrie
 
unfortunatly RS doesn't do anything with dates, one way you could do it is to create a date parameter for the month, then in the data tab click on the elipse and go to the filter tab. Enter your expression

"Monthfield = Parameter"

Then it will filter out all months that dont match the one selected
 
Do you have a column that already holds the month? Such as:
Code:
TheDate    Month      TopDog
1/4/05     1          Tom
1/21/05    1          Alex
2/4/05     2          Susan
3/15/05    3          Tom
4/24/05    4          Tom
If so, then it's easy. You just make a parameter @month, and then put a filter on your dataset where "Month= @month". You could even have a drop-down box where the month number is the hidden value, and the month name is really what they select (January = 1, etc).

If you don't have a Month column yet (either names or numbers), it's easy to make one in your original query or stored procedure. Just do:
Code:
SELECT   TheDate, [b]DATEPART(mm,TheDate) Month[/b], TopDog
FROM     YourTable
ORDER BY TheDate
Behold, you have a new Month column. The resultant recordset looks just like the one I posted above.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top