Printing Current Form Details (1 Viewer)

PEASLET

Registered User.
Local time
Today, 02:18
Joined
May 15, 2001
Messages
20
I've looked at the other threads & still don't get it. I assigned a macro to a command button to print current form details. It prints the details across 6 pages. So I've designed a report based on a query to fit it to the page. So how do I get the button to print the report for just the current record? Do I put criteria in the query? I know it'll be simple but I'm confused. Any ideas grealy appreciated!
 

Rich@ITTC

Registered User.
Local time
Today, 02:18
Joined
Jul 13, 2000
Messages
237
Hi Peaslet

Better to do it through coding.

-----------------------------------------
Sub cmdButtonName_Click():
On Error GoTo Err_cmdButtonName_Click

Dim strDocName As String
Dim strLinkCriteria As String

strDocName = "rptYourReportName"
strLinkCriteria = "[CustomerID] = Forms![frmYourFormName]![CustomerID]"

DoCmd.OpenReport strDocName, acPreview, , strLinkCriteria

Exit_cmdButtonName_Click:
Exit Sub

Err_cmdButtonName_Click:
MsgBox Err.Description & " - (Error No:" & Err.Number & ")"
Resume Exit_cmdButtonName_Click

End Sub
----------------------------------------

Obviously you replace "ButtonName" with whatever you have called the button and similarly "YourReportName" and "YourFormName". I would advise using a naming convention - cmd for command button, frm for Form etc.

Rich Gorvin

[This message has been edited by Rich@ITTC (edited 05-18-2001).]
 

PEASLET

Registered User.
Local time
Today, 02:18
Joined
May 15, 2001
Messages
20
excellent, thanks alot
 

Users who are viewing this thread

Top Bottom