Print Report based on Current Record

K

Kate

I would like to print a report based on the current
record, however I do not want to add a button to the
form. I would like to be able to print the report from a
menu bar. I can actually get the report to open, but it
is not linking up to the record that it needs to print
info for. Here is the code that I know works if I have a
button on the form....how do i get it to work from a menu
bar????

Public Function PrintLetter()
' This code created by Command Button Wizard.
On Error GoTo Err_PrintLetter

Dim strDocName As String

stDocName = "rpt_075 Denial"
DoCmd.OpenReport stDocName, acPreview, , "PCSP_GUID
= '" & Mid(StringFromGUID(Forms!usys_frmMain.PCSP_GUID),
7, 38) & "'"

Exit_PrintLetter:
Exit Function

Err_PrintLetter:
' If action was cancelled by the user, don't display
an error message.
Const conErrDoCmdCancelled = 2501
If (Err = conErrDoCmdCancelled) Then
Resume Exit_PrintLetter
Else
MsgBox Err.Description
Resume Exit_PrintLetter
End If

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top