View Full Version : variable to Access report from query
Kicker
10-19-2006, 05:21 PM
I have a query in an Access Database. when run, I enter a date and the query automatically creates a range and selects those records withinn that range.
This query is used for the data source to a report. When I open the report, I am asked for the parameter. However, I can't seem to use the parameter in the header of the report. for example: if I enter the date of "10/20/06", I want the header for the printed report to be
Records for 10/20/06
Seems simple enough, but driving me crazy.
thanks for your help
You are correct, it is very difficult to use a parameter in a Report.
To overcome this problem (and it is better programming) I use a "Search Form" which has Input fields to match the data that you are looking fro in your query. The field, in your case a date can be put in to both the Criteria row and also a column Heading. In this way it can be used both as a filter and as a field for your report to use.
The format for including the field in a query is
forms![Form Name]![Field Name]
where the form name is the name of your form and the field name is the name of your field on your form. http://vbaexpress.com/forum/images/icons/icon7.gif
Norie
10-20-2006, 10:31 AM
Why not just add a textbox to the report and set it's control source to something like this.
=[My parameter]
That works for me.
Norie, thanks for that.
As I said I don't use the parameter input. but we live a learn.
Is that a proper declared Parameter Query or just a criteria row parameter?
Norie
10-21-2006, 08:56 AM
OBP
It's just a criteria row parameter in the query the report is based on.
I've yet to test it with other types of parameters. eg from a form
I'll do that and post back later.:)
Norie, that works OK as a criteria parameter, except "My Parameter" has to be the name of the parameter used in the query criteria, not literally "My parameter". :rotlaugh:
Norie
10-21-2006, 11:17 AM
OBP
I'm not quite sure what you mean.:ack::hide:
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.