Wrox Programmer Forums
|
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
 
Old September 13th, 2005, 02:15 AM
Authorized User
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old September 13th, 2005, 07:00 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old September 13th, 2005, 09:37 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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
 
Old September 13th, 2005, 10:17 AM
Authorized User
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old September 13th, 2005, 03:43 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

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
 
Old September 16th, 2005, 04:03 AM
Authorized User
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old September 16th, 2005, 06:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
parameters into sub reports alandimech BOOK: Professional Crystal Reports for VS.NET 1 October 30th, 2007 11:17 AM
Crystal Reports - Parameters pramesh_it Crystal Reports 1 April 12th, 2006 04:21 AM
Crystal Reports Parameters Amadago Crystal Reports 1 April 12th, 2004 11:35 PM
reports with parameters lea417 Crystal Reports 4 January 26th, 2004 12:55 PM
Passing parameters to reports jammykam Access 2 October 8th, 2003 02:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.