Private Sub Report_Close()
Dim msg, style, response As String
msg = "Do you want to email this report to John Doe?"
style = vbYesNo
On Error Resume Next
response = MsgBox(msg, style)
If response = vbYes Then
DoCmd.SendObject acSendReport, , acFormatSNP,
"jd...@gospamyourself.com", , , "(subject)"
DoCmd.Restore
DoCmd.Close acForm, "formfinancelogreport"
Forms!formlauncher.Visible = True
Else
DoCmd.Restore
DoCmd.Close acForm, "formfinancelogreport"
Forms!formlauncher.Visible = True
End If
End Sub
it won't send the report for some reason. formfinancelogreport and
formlauncher are two forms that go visible=false when the report is opened.
it closes the report, closes the one form and sets visible to true on the
other (as it should). but no emails thus far. what am i missing?
--
Message posted via http://www.accessmonster.com
Try the following
DoCmd.SendObject acReport, "(report name)", "SnapshotFormat(*.snp)", "(email
address)", "", "", "(subject)", "", False, ""
--
Allan Murphy
Email: allan...@unwired.com.au
"kaos...@comcast.net via AccessMonster.com" <u15580@uwe> wrote in message
news:5a820274d257a@uwe...
DoCmd.SendObject acSendReport, "rptmonthendreport", acFormatSNP, "(email
address)", , , "(subject)"
as that line of code. sorry bout that. anything else stick out as missing
or wrong?
Allan Murphy wrote:
>You are missing the report name
>
>Try the following
>DoCmd.SendObject acReport, "(report name)", "SnapshotFormat(*.snp)", "(email
>address)", "", "", "(subject)", "", False, ""
>
>> i put this code in my close event of a report:
>>
>[quoted text clipped - 26 lines]
DoCmd.SendObject acReport, "rptmonthendreport","SnapshotFormat(*.snp)",
"(email address)", "", "", "(subject)", "", False, ""
If in doubt create a macro to send your email, save the macro then use
tools-> options-> macro-> convert macro to VB. This will produce the macro
in the correct code.
--
Allan Murphy
Email: allan...@unwired.com.au
"kaos...@comcast.net via AccessMonster.com" <u15580@uwe> wrote in message
news:5a8f8f33e2103@uwe...
Allan Murphy wrote:
>Besides missing the report name try using the line of code as below.
>
>DoCmd.SendObject acReport, "rptmonthendreport","SnapshotFormat(*.snp)",
>"(email address)", "", "", "(subject)", "", False, ""
>
>If in doubt create a macro to send your email, save the macro then use
>tools-> options-> macro-> convert macro to VB. This will produce the macro
>in the correct code.
>
>> ya, that was actually an error in my post, not my code. when i wiped out the
>> real email address i must have wiped out that part too. i have this:
>[quoted text clipped - 16 lines]
docmd.runmacro "emailrptmonthendreport"
i get a window telling me that the macro failed. is it possible that access
is closing the report "before" sending the report with the macro/vba? if so,
is there a way to delay this so it works on the report's close event. i
absolutely need to be able to prompt the user to email this report or not so
i can't take away the msgbox part of all of this. i don't know my a$$ from
my elbow with vba so you'll forgive me if this question is obvious or not
entirely lucid. thanks.
kaos...@comcast.net wrote:
>aarrghh. i did exactly what you said (both suggestions) and it didn't work.
>it just closes the report and a tiny window pops up for about a quarter of a
>second that says SOMETHING but it closes too quickly for me to see it. (even
>if i remove the code about closing and visible=true on the other forms). i'm
>just stuck.
>
>>Besides missing the report name try using the line of code as below.
>>
>[quoted text clipped - 10 lines]