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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a selected date range to a graph on a report

Status
Not open for further replies.

chiefman

Programmer
Oct 17, 2003
94
US
Does anyone have any idea how to get a graph to accept a date range from another form? I have to generate graphs from selected date criteria. I'm generating my graphs based on queries and I pass the criteria to the report from another form using text boxes that display the date range info at the top of each "date range" report.

Ex.
02/10/2006 To 02/24/2006 Weekdays

-OR-

1/1/2005 To 1/1/2006 Holidays

I wasn't sure if it was even possible to pass that to a graph, but if anyone has any ideas it would be greatly appreciated. Thanks in advance.

 
A graph control has a Row Source which is a query. You can set criteria in this query like any other query. If your Row Source is a crosstab query, you must set the query parameter data types.

Ideally your criteria should come from controls on forms, not parameter prompts.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Ok, thanks. I'll try to plug it in to the query and see what I get. I've never like parameter prompts either, they leave too much margin for error.
 
I may have to mess with that some to get it to work, but I also have a combo box on the date select form that has possible values of "All","Weekday","Weekend","Saturday","Sunday","Holiday".This is in turn passed to the report and stored in a text box on the report. Any idea how I could do any testing to see if the record meets that condition for the graph? Basically what I have done on other reports is just set up an "If" statement that would look something like:

If TextboxName = "Weekend" And RecordDate>= StartDate And RecordDate<=EndDate Then
If DateInputVariable = "Saturday" Or "Sunday" Then
execute code to include record in total

I'm just not sure how to do that with a graph or even if anything like that is possible given the nature of graphs in MS Access.
 
You should be able to use logic something similar to what you are doing with your reports. How are we supposed to understand your holidays, data, queries, reports,....?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
I wasn't asking you to read my mind. I was stating a secondary problem and asking if anyone has ever come across anything similar. Or if anyone knew of any other ways to specify criteria to a graph besides putting it directly into a query.
 
I expect you have a form to make your selections. You could make a couple visible or invisible text boxes that would be updated by your selections. It looks like you would need min and max dates and min and max weekdays. Your Row Source of the graph could reference these text boxes.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top