bluedemon186
Registered User.
- Local time
- Yesterday, 18:55
- Joined
- Dec 7, 2011
- Messages
- 20
Hello,
I am using the following code to open another form to a specific record and email a pdf of that particular record. It works in one of the form and gives an error in another. Can someone please take a look at the code and see why it is giving me that error. From what I understand it might be the Do.Cmd.Sendobject line. To add further it only gives me that error when I try to use the button for old records. It works just fine with the newer records.
I am using the following code to open another form to a specific record and email a pdf of that particular record. It works in one of the form and gives an error in another. Can someone please take a look at the code and see why it is giving me that error. From what I understand it might be the Do.Cmd.Sendobject line. To add further it only gives me that error when I try to use the button for old records. It works just fine with the newer records.
Code:
Private Sub Command284_Click()
On Error GoTo Command284_Click_Err
DoCmd.RunCommand acCmdSaveRecord
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "SampleNotification"
stLinkCriteria = "[Sample_Nbr]=" & "'" & Me![Sample_Nbr] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.SelectObject acForm, stDocName, True
Forms("SampleNotification").Printer.Orientation = acPRORLandscape
DoCmd.SendObject acForm, "SampleNotification", "PDFFormat(*.pdf)", Me.ClientEmail, "", "", "Sample Notification", "", True, ""
Command284_Click_Exit:
Exit Sub
Command284_Click_Err:
MsgBox Error$
Resume Command284_Click_Exit
End Sub
Last edited: