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
 
Top