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  

Open and Preview a Single Record in a Report



 
 
Thread Tools Display Modes
  #1  
Old April 6th, 2010, 02:59 PM posted to microsoft.public.access.reports
Brian T
external usenet poster
 
Posts: 45
Default 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  
Old April 6th, 2010, 04:13 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default 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  
Old April 7th, 2010, 03:09 PM posted to microsoft.public.access.reports
Brian T
external usenet poster
 
Posts: 45
Default 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  
Old April 7th, 2010, 05:11 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default 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

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 07:25 AM.


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