I can only E-Mail a Report once!

  • Thread starter Mo Williams via AccessMonster.com
  • Start date
M

Mo Williams via AccessMonster.com

Hi,

I have set up some code to e-mail a single record attached to a button and
it works once and then on a second press only previews the report!

No error message comes up and it can be reset by closing the database and
pressing it again!

Can anyone tell me why I can only e-amil the report once and have to close
and restart the database to do it again!

the code is as follows;
__________________________

Private Sub Report_1_Click()
On Error GoTo Err_ Report_1_Click

Dim stDocName As String

stDocName = "Report_1"
stOutputFormat = "Snapshot Format"
stTo = "<e-mail addresses entered here!>"
stCC = "<e-mail addresses entered here!>"
stSubject = "New Report for Review"
stMessage = "<message text here>"

DoCmd.OpenReport stDocName, acViewPreview, , "[Ref_No]=" & "'" & Me!
[Ref_No] & "'"
DoCmd.SendObject acReport, stDocName, stOutputFormat, stTo, stCC, ,
stSubject, stMessage

Exit_ Report_1_Click:
Exit Sub

Err_ Report_1_Click:
MsgBox Err.Description
Resume Exit_ Report_1_Click

End Sub
__________________________________________

Thanks in advance!

Mo
 

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