Rabu, 09 Mei 2012

RE: [MS_AccessPros] Programing

 

Rmilsley-

The common technique is to add a command button (Print This Record) and then put
code in the Click event of the button to open a companion report with a filter.
Let's say your form edits customers and the unique ID is CustomerID. Your Click
event code might look like:

Private Sub cmdPrintThis_Click()
DoCmd.OpenReport "rptCustomers", acViewPreview, WhereCondition:="CustomerID
= " & Me.CustomerID
End Sub

That one line of code opens the report named rptCustomers in Print Preview and
shows only the record that matches the current CustomerID in the form where this
is running.

You can do a similar thing with the OpenReport command in a macro tied to the
Click event of the command button.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

------------------------

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of rmilsley
Sent: Wednesday, May 09, 2012 8:25 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Programing

 
I am new to programming in Access. I am using Access 2010 and would like to be
able to print the current record's data to a specific report, without printing
all the data associated with the form. Thanks for all your help.

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar