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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|