A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to pass parameters to a report



 
 
Thread Tools Display Modes
  #1  
Old December 18th, 2009, 11:15 PM posted to microsoft.public.access.reports
RS
external usenet poster
 
Posts: 171
Default How to pass parameters to a report

I am new user and do not know much about Access Programming. I have a form
where I have a number field called memberid. I have created a report called
member report which works baed on memberquery. Which is baed on a query
memberquery. I have a form which fromupdate . I want to put a command button
on this page. I want this command button to read value from memberid textbox
and generate the report for only that member.

I have parametrized the query and it asks me enter memberid and then
genrates the report for that member.

I want this to happen just by clicking that button. It should be able to
read memberid field value and create report for only that member. I do not
want a dialogbox to appear asking me the memberid.

Thank You in advance.
  #2  
Old December 18th, 2009, 11:33 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default How to pass parameters to a report

I would modify the code in the command button like:

Dim strWhere as String
Dim strReportName as String
'assuming a numeric field named "MemberID"
strWhere = "[MemberID] = " & Me.memberID
strReportName = "Member Report"
DoCmd.OpenReport strReportName, acViewPreview, , strWhere

Then, make sure you remove the parameter prompt from the query.

--
Duane Hookom
Microsoft Access MVP


"RS" wrote:

I am new user and do not know much about Access Programming. I have a form
where I have a number field called memberid. I have created a report called
member report which works baed on memberquery. Which is baed on a query
memberquery. I have a form which fromupdate . I want to put a command button
on this page. I want this command button to read value from memberid textbox
and generate the report for only that member.

I have parametrized the query and it asks me enter memberid and then
genrates the report for that member.

I want this to happen just by clicking that button. It should be able to
read memberid field value and create report for only that member. I do not
want a dialogbox to appear asking me the memberid.

Thank You in advance.

  #3  
Old December 19th, 2009, 10:03 PM posted to microsoft.public.access.reports
Armen Stein[_2_]
external usenet poster
 
Posts: 157
Default How to pass parameters to a report

One way to have a report prompt the user for criteria before it runs
is to open a form from the report's Open event. Open the form in
Dialog mode so that the report waits for the form to be closed or
hidden before it proceeds. That way you can collect criteria from the
user and build a Where clause for the report. It also means that you
can call the report directly - you don't need to call it from a form.
And the selection form is reusable - it can be called from multiple
reports if they need the same criteria.

I've posted examples of this technique on our J Street Downloads page
at http://ow.ly/M58Y
See "Report Selection Techniques".

Armen Stein
Microsoft Access MVP
www.JStreetTech.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.