Sending report via email

F

FA

Hi Freinds, I have a command button that opens a report on the form.
Here is my code to open a report
On Error GoTo Err_rptFindingReport_Click
DoCmd.OpenReport "FindingReport", acPreview, , "[SYS_ID_CODE]=" &
[SYS_ID_CODE]
Me.Visible = True
Exit_rptFindingReport_Click:
Exit Sub
Err_rptFindingReport_Click:
MsgBox Err.Description
Resume Exit_rptFindingReport_Click
End Sub

I created another command button on the same form which should email
the same report to anybody. Here is my code for that command button

Dim strEmail As String
Dim strMailSubject As String
Dim strMsg As String
Dim stLinkCriteria As String
Dim strReport As String

strEmail = "John Gorden" & vbNullString
strMailSubject = "" & vbNullString
strMsg = "" & vbNullString & vbCrLf & vbCrLf & "" & _
vbCrLf & ""
strReport = "FindingReport"
stLinkCriteria = "[SYS_ID_CODE]=" & Me![SYS_ID_CODE]

DoCmd.SendObject objecttype:=acSendReport, _
ObjectName:="strReport", outputformat:=acFormatSNP, _
To:=strEmail, Subject:=strMailSubject, MessageText:=strMsg

Exit_Command586_Click:
Exit Sub

Err_Command586_Click:
MsgBox Err.Description
Resume Exit_Command586_Click

Its not working, if anybody can tell me what i am doing wrong, i would
be much thankful. Thanks

Moe
 

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