Send EMail through access. Focus back to Access

FrostByte

Registered User.
Local time
Today, 16:36
Joined
Jan 15, 2015
Messages
56
Hi there,

I am new here and an not great with access. I do manage to stich code together to achieve my goals. Below is my code to send an e-mail from within a form using outlook. It all works fine apart from the fact my access system is essentially locked out whilst the New E-Mail Window is open.

This is very annoying as I still want to refer and use my access form whilst the e-mail window is open, and not be frozen out until I send or exit from the e-mail.

Regards
Steve

*********************************************
Private Sub Command187_Click()
On Error GoTo OakErr
Dim stWhere As String '-- Criteria for DLookup
Dim varTo As Variant '-- Address for SendObject
Dim stText As String '-- E-mail text
Dim RecDate As Variant '-- Rec date for e-mail text
Dim stSubject As String '-- Subject line of e-mail
Dim stWho As String '-- Reference to tblUsers
Dim stHelpDesk As String '-- Person who assigned ticket
Dim strSQL As String '-- Create SQL update statement
Dim errLoop As Error

varTo = "Email_address_here" stSubject = "* Invoice for your attention* " & "Our Reference : " & Me.Claim_Ref & "- (" & "Invoice Number : " & Me.Invoice_Num & ")"
stText = "Please find attached an Invoice for your attention." & Chr$(13) & _
" " & Chr$(13) & _
"Our Reference : " & Me.Claim_Ref & Chr$(13) & _
"Invoice Number : " & Me.Invoice_Num & Chr$(13) & _
"Policy Ref Num : " & Me.Policy_Ref_Num & Chr$(13) & _
"Vehicle VRM : " & Me.Registration & Chr$(13) & _
" " & Chr$(13) & _
" " & Chr$(13) & _
" " & Chr$(13) & _
"Regards" & Chr$(13) & _
"Steve " & Chr$(13) & _
"Director" & Chr$(13) & _
" " & Chr$(13)

DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1

OakErr:
End Sub
*********************************************
 
try whacking in a 'Do Events' I think it is just before your docmd.sendobject
 
try whacking in a 'Do Events' I think it is just before your docmd.sendobject

Hi,

Thanks for the reply. Do you mean just type Do Events right before the docmd....

Do Events docmd.sendobject?

What does that do?
 
it allows you to carry on doing what you want while VBA is processing iirc
put it on the line above the code, or the one below it I can't remember for sure I think it's the one above. HTH!
 

Users who are viewing this thread

Back
Top Bottom