 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 13th, 2005, 02:15 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Parameters & reports
Hi
Just need a pointer on this one i think.
I have a parameter query, that I use to run a report, so when I run the report I'm propted for a user id.
From the user record form I have a button to run the report.
What I want to do is pass the user id into the report, and not have the prompt.
Is this easy to do.
Andy G
|
|

September 13th, 2005, 07:00 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi
This is quite easy to do.
All you have to do is change your parameter to refer to your form.
Example [Forms]![Users]![UserID] and that´s it
-vemaju
|
|

September 13th, 2005, 09:37 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
This will only allow you to use this query from the one form. If you use it for other forms/reports, then remove all criteria from the query and pass it directly from the form. Let us know if you need to know how to do that.
mmcdonal
|
|

September 13th, 2005, 10:17 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Both
The report is only run from the one form so vemaju's solution will work.
I can't help thinking that sendng the criteria from the form is a 'better' way.
Yes I would like a pointer as to how to do it.
Andy G
|
|

September 13th, 2005, 03:43 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
On your form's open report button, you'd have something like
DoCmd.OpenReport "Your Report Name", acPreview, , "[Your Numeric Field] = " & Me.txtYourNumericField
DoCmd.OpenReport "Your Report Name", acPreview, , "[Your Date Field] = #" & Me.txtYourDateField & "#"
DoCmd.OpenReport "Your Report Name", acPreview, , "[Your Text Field] = '" & Me.txtYourTextField & "'"
Place your report's real name in "Your Report Name", place your field's real name in [Your Field], and place the name of the textbox that is bound to your field in Me.txtYourField. The first line is for the case where your field is a number, the second is if your field is a date, and the third is if your field is text, respectively.
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
|
|

September 16th, 2005, 04:03 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Greg
Works Ok, once I figured out to remove the parameter from the query.
You don't know of an easy way to take the contents of the report and stick them in the email body, rather than the attachment.
Andy
|
|

September 16th, 2005, 06:47 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
Sure, to place text in the body of the e-mail instead of the attachment, look up help for DoCmd.SendObject method.
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
|
|
 |