Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

Reports: Print only the current record to a report

Author(s)
Dev Ashish

(Q) I'm trying to print out only the current record from my form in a report but each time all the records print out. How can I print only one record using a report?

(A) Use the OpenReport's Where condition to specify your record. For example, the following code placed behind a command button on the form would use the RunID control on the form to restrict the Report to only one record.

'******************** Code Start ************************
Dim strDocName As String
Dim strWhere As String
    strDocName = "rptSomeReport"
    strWhere = "[RunID]=" & me!RunID
    DoCmd.OpenReport strDocName, acPreview, , strWhere
'******************** Code End ************************

© 1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer