Could someone help me with this, please?
I run Access2000 on XP
Have created a Report.
Have placed a button on a form to email the report
Works fine - email is generated, ready to input the To address & send. However If I decide not to send it afterall and (X) close the email this is what happens:
* I get a dB error message (1) which I can close with an OK,
* then it runs the button's error message (Code line 19) ,
* then it locks up the exiting of the whole database with another error message(3) and I have to Ctr/Alt/Del to get out....I can stay in the database and roam about to any other area, form , eport etc, can even again generate the same report in email and sucessfully send it, but I can't Quit the DB.
This is the code:
Expand|Select|Wrap|Line Numbers
- Private Sub MAILRPT_Click()
- On Error GoTo Err_MAILRPT_Click
- DoCmd.SendObject _
- acSendReport, _
- "rptCTStatus", _
- acFormatRTF, _
- , _
- , _
- , _
- "Status Report", _
- "Attached is the Status Report Do not reply to this Automated Email ", _
- True
- Exit_MAILRPT_Click:
- Exit Sub
- Err_MAILRPT_Click:
- MsgBox "Send of Report is cancelled!"
- Resume Exit_MAILRPT_Click
- End Sub
Message 1: <Title: Database Name> - the SendObject action was cancelled. You used a method of the DoCmd Object to carry out an action in Visual Basic, but then clicked Cancel in a Dialog Box...."
Message3: "You can' exit the <Database Name> now. If you're running a Visual Basic Module that is using OLE or DDE, you may need to interrupt the module"
So my question: How do I amend this code to allow for a user changing their mind and cancelled the sending of the email, and preventing the messges 1 and 3??
Thanks! Hope you can help and hopefully simple to fix!
Cheers
AMBLY