Hello everyone! I have a database that is used by multiple users. Every button and module works as intended except one. I have a hyperlink field that when clicked, it opens a report using the selected record's ID, attaches it to an email and closes the report afterwards. It works wonderful for me, but not for the other users. I have checked that all MS Access, Outlook and Windows versions are the same, libraries are the same, etc. It's the exact same front end, and all other modules work just fine.
I found out the problem is that when clicked, it doesn't run the "Open report" command at all. Any ideas?
Here's the code:
I found out the problem is that when clicked, it doesn't run the "Open report" command at all. Any ideas?
Here's the code:
Code:
Private Sub txtOpen_Click()
On Error GoTo ErrorHandler
Me.Dirty = False
'error check if the ID is null
If IsNull(Me!Req_ID) Then
MsgBox "Please select a valid record", _
vbOKOnly, "Error"
Exit Sub
End If
'Open report so it passes on the ID and shows the Doc for selected record
DoCmd.OpenReport "Qualification Document", acViewReport, , _
"Req_ID = " & Me!Req_ID
'Attaches the report to an email ready to send
DoCmd.SendObject acSendReport, "Qualification Document", acFormatPDF, _
Me.[E-mail Address], , , "Document for " & [Contact Name], "Find attached the document.", True
'close report after sending email
DoCmd.Close acReport, "Qualification Document", acSaveNo
MsgBox "Message Sent Successfully."
Cleanup:
DoCmd.Close acReport, "Qualification Document", acSaveNo
Exit Sub
'catches error if the user closes email without sending
ErrorHandler:
Select Case Err.Number
Case 2501
MsgBox "Email message was Cancelled."
Case Else
MsgBox Err.Number & ": " & Err.Description
End Select
Resume Cleanup
End Sub