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!

Can't exit MS Access now you may need to interupt the module

Status
Not open for further replies.

Costefran

Technical User
Jan 2, 2008
197
GB
Can anyone help

I currently have some code for creating an email which works fine until I change my mind and cancel the email

I was getting a msgbox pop up saying send action cancelled

and now my access hangs and when I try to close access it says

You can't exit Microsoft Access right now as you are running a DDE or OLE procedure. You may need to inturupt the module

I'm not sure what this means or what I have done so any help would be appreciated

My code is as follows

Private Sub Email_Works_Owner_Click()
On Error GoTo Err_Email_Works_Owner_Click
If Me.Clash_or_Not = "Handover Required" Then DoCmd.SendObject acSendReport, "Work Planning Report", acFormatSNP, Me.User_Email_Address, "", "", "14 Day Planning Work Sequencing", "Please note work I am trying to plan works on the" & Me.My_System_to_be_worked_on & " at " & Me.My_Building & (Chr(13) + Chr(10)) & "from " & Me.My_Start_Date & " to " & Me.My_End_Date & " and it has been identified that there is a handover required" & (Chr(13) + Chr(10)) & "A report is attached showing all work taking place at the same time. I will call you to discuss sequencing", True, ""
If Me.Clash_or_Not = "Clash" Then DoCmd.SendObject acSendReport, "Work Planning Report", acFormatSNP, Me.User_Email_Address, "", "", "14 Day Planning Work Clash", "Please note work I am trying to plan works on the" & Me.My_System_to_be_worked_on & " at " & Me.My_Building & (Chr(13) + Chr(10)) & "from " & Me.My_Start_Date & " to " & Me.My_End_Date & " and it has been identified that there is a clash with works at " & Me.Building & (Chr(13) + Chr(10)) & "A report is attached showing all work taking place at the same time. I will call you to discuss the possibility of altering the date or sequencing the work", True, ""
If IsNull(Me.Clash_or_Not) Then DoCmd.SendObject acSendReport, "Work Planning Report", acFormatSNP, Me.User_Email_Address, "", "", "Planning Work Report", "Please find attached a report identifying works from " & Me.My_Start_Date & " to " & Me.My_End_Date, True, ""

Exit_Email_Works_Owner_Click:
Exit Sub
Err_Email_Works_Owner_Click:
MsgBox Err.Description
Resume Exit_Email_Works_Owner_Click
End Sub
 
I did a test and could not duplicated your problem. Your code looks OK and properly handles the error. Access should not freeze after you dismiss the error.

Try recompiling the Access database and rebooting your workstation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top