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
|
|||
|
|||
Open and Preview a Single Record in a Report
I have a report where I would like to open and print only the chosen record.
How to I specify the record? Thanks |
#2
|
|||
|
|||
Open and Preview a Single Record in a Report
Brian T wrote:
I have a report where I would like to open and print only the chosen record. How to I specify the record? If you have a form where users can navigate to the desired record, then add a command button to open the report. The code behind the button would look something like: Dim stWhere As String stWhere = "[primary key field]=" & Me.[primary key field] DoCmd.OpenReport "report name", acviewPreview, , stWhere -- Marsh MVP [MS Access] |
#3
|
|||
|
|||
Open and Preview a Single Record in a Report
Thanks, but is there a way to write the same thing into an embedded macro?
"Marshall Barton" wrote: Brian T wrote: I have a report where I would like to open and print only the chosen record. How to I specify the record? If you have a form where users can navigate to the desired record, then add a command button to open the report. The code behind the button would look something like: Dim stWhere As String stWhere = "[primary key field]=" & Me.[primary key field] DoCmd.OpenReport "report name", acviewPreview, , stWhere -- Marsh MVP [MS Access] . |
#4
|
|||
|
|||
Open and Preview a Single Record in a Report
I don't use macros so all I can do is assume there is a way.
Probably using the OpenReport action with: "[primary key field]=" & Me.[primary key field] in the WhereCondition argument. -- Marsh MVP [MS Access] Brian T wrote: Thanks, but is there a way to write the same thing into an embedded macro? "Marshall Barton" wrote: Brian T wrote: I have a report where I would like to open and print only the chosen record. How to I specify the record? If you have a form where users can navigate to the desired record, then add a command button to open the report. The code behind the button would look something like: Dim stWhere As String stWhere = "[primary key field]=" & Me.[primary key field] DoCmd.OpenReport "report name", acviewPreview, , stWhere |
Thread Tools | |
Display Modes | |
|
|