Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Freezing

Status
Not open for further replies.

Costefran

Technical User
Jan 2, 2008
197
GB
Can anyone help

I have a command button on my form that sets up an email ready to send via a macro

All works fine but if the user cancels the email access freezes

When I try to close via the task manager I get the following message

"You Can't exit MS Access Now"
If you are running a visual basic module that is using OLE or DDE you may need to interupt the module"

I suppose I'm missing sime cide or something and have looked on the Web but cannot find the answer
 
Convert your macro to VBA and add some error trapping.

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Thanks for the response

Have run it from code as shown below and am still getting the same problem. Please note, I'm a novice when it comes to code so it's probabaly wrong somewhere

Here's the code and many thanks

Private Sub EMAIL_VENDOR_AUTHORISATIONS_REQUIRED_Click()
On Error GoTo Err_EMAIL_VENDOR_AUTHORISATIONS_REQUIRED_Click



DoCmd.SendObject acReport, "Pending All Vendor Authorisations", "SnapshotFormat(*.snp)", "", "", "", "Approvals Required", "Please note there are a number of Approvals now required", True, ""



Exit_EMAIL_VENDOR_AUTHORISATIONS_REQUIRED_Click:
Exit Sub

Err_EMAIL_VENDOR_AUTHORISATIONS_REQUIRED_Click:
MsgBox Err.Description
Resume Exit_EMAIL_VENDOR_AUTHORISATIONS_REQUIRED_Click


End Sub

 
Simple way is to ignore that particular error
Code:
Private Sub EMAIL_VENDOR_AUTHORISATIONS_REQUIRED_Click()
    On Error GoTo Err_EMAIL_VENDOR_AUTHORISATIONS_REQUIRED_Click


    DoCmd.SendObject acReport, "Pending All Vendor Authorisations", "SnapshotFormat(*.snp)", "", "", "", "Approvals Required", "Please note there are a number of Approvals now required", True, ""


Exit_EMAIL_VENDOR_AUTHORISATIONS_REQUIRED_Click:
    Exit Sub

Err_EMAIL_VENDOR_AUTHORISATIONS_REQUIRED_Click:
   [b] Select Case Err.Number
    Case Is = 2501
        Resume Next
    Case Else
        MsgBox Err.Description

    End Select
[/b]
    Resume Exit_EMAIL_VENDOR_AUTHORISATIONS_REQUIRED_Click

End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Thanks for this have attached code and now getting the following message

"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 the dialog box. For example you used the closed method to close a changed form, then clicked cancel in the dialog box that asks if you want to save the changes you made to the form'

To recap the command button opens the email and if the user decides to close without sending by clicking the cross in the top right hand corner then I get the above message and the original form freezes

Thanks
 
i can't recreate the error as error number 2501 is "The SendObject Action was cancelled"

Check if it breaks on other code error

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
ZmrAbdulla

thanks for your help although still cannot seem to solve. I have been told by another that when I sendobject it places the object in memory and then when cancelling I should release object although I sort of understand I'm getting out of my depth. Is there an instruction in VB that release the object in this situation

Thanks
 
Try
Code:
    Select Case Err.Number
    Case Is = 2501
    
   [b] Err.Clear[/b]
    
    Case Else
        MsgBox Err.Number & ": " & Err.Description

    End Select
AFIK The object will be released after the command.
Try to do a Compile from the code window > Debug > Compile <your db name>
This will bring any mistakes in code in to front.

Then do Compact & Repair of DB.

BTW, There are lots of ways to send mail from Access DB with / without attachments.

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top