Don't want to send mail

J

Jean-Paul

Hi,
Following code sends a report through email

DoCmd.SendObject acSendReport, "Te bezoeken2", acFormatSNP,
MP_Setup.verkopers, , , "Algemeen overzicht week " & Me!weeknummer & "
van " & MP_Setup.gebruiker, "", False

This works like it should

But, upon sending through Outlook, I get a message saying access is
trying to automatically send an e-mail.
It all has to do with virus-controling...

My question(s)
Can I turn this of
When I answer "YES"... it's OK
When I answer "No" I get error 2293 saying the mail can not be send...
I don't want this messagebox to pop up...
Can I prevent this?

Thanks
 
J

Jean-Paul

This is a bit complicated for me... zo please could you help?

This my current code:

Private Sub Knop247_Click()
Me!verstuurd = "J"
DoCmd.SendObject acSendReport, "Te bezoeken2", acFormatSNP,
MP_Setup.verkopers, , , "Algemeen overzicht week " & Me!weeknummer & "
van " & MP_Setup.gebruiker, "", False
End Sub

This is the suggested code:

Sub|Function SomeName()
On Error GoTo Err_SomeName
' Code to do something here.
Exit_SomeName:
Exit Sub|Function
Err_SomeName:
MsgBox Err.Number & Err.Description
Resume Exit_SomeName
End Sub|Function

Don't know what to do with Sub|Function SomeName()

Thanks you
 
D

Douglas J. Steele

Private Sub Knop247_Click()
On Error GoTo Err_Knop247_Click

Me!verstuurd = "J"
DoCmd.SendObject acSendReport, "Te bezoeken2", acFormatSNP, _
MP_Setup.verkopers, , , "Algemeen overzicht week " & _
Me!weeknummer & " van " & MP_Setup.gebruiker, "", False

Exit_Knop247_Click:
Exit Sub

Err_Knop247_Click:
Select Case Err.Number
Case 2293
Resume Next
Case Else
MsgBox Err.Number & Err.Description
Resume Exit_Knop247_Click
End Select

End Sub
 
J

Jean-Paul

extra quetion:

This is my code at this moment:

.....................
If Me!ietsveranderd = "J" And Me!verstuurd = "N" Then
On Error GoTo Err_Knop6_Click
DoCmd.SendObject acSendReport, "Te bezoeken2", acFormatSNP,
MP_Setup.verkopers, , , "Algemeen overzicht week " & Me!weeknummer & "
van " & MP_Setup.gebruiker, "", False
DoCmd.SendObject acSendReport, "Te bezoeken2", acFormatSNP,
MP_Setup.Chef, , , "Algemeen overzicht week " & Me!weeknummer & " van "
& MP_Setup.gebruiker, "poging tot", False
Exit_Knop6_Click:
Exit Sub
Err_Knop6_Click:
Select Case Err.Number
Case 2293
Resume Next
Case Else
MsgBox Err.Number & Err.Description
Resume Exit_Knop6_Click
End Select
End If
DoCmd.Close
End Sub

When I click "No" on the dialog box, I think I leave the sub without the
program executing the DoCmd.close command
Where schould I add or place this command so it is always executed?

Thanks
 
D

Douglas J. Steele

Move the DoCmd.Close from where it is to between Exit_Knop6_Click and Exit
Sub:

Exit_Knop6_Click:
DoCmd.Close
Exit Sub

Err_Knop6_Click:
 

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