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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Activate Access After sending Email

Status
Not open for further replies.

OzzieTheOwl

Technical User
Jun 26, 2006
61
GB
I have a routine which sends an email from a form, the problem is that once the email has been sent the focus is still on Outlook, does anyone know how to make the Access DB the focus again?

Thanks in Advance

Barney
 
Could you post your current code? I use a sendmail funcion and outlook never appears (only the mail window if you request to view it)
 
Current Code As requested

Code:
Private Sub cmdEmailDriver_Click()
    Dim o As Outlook.Application
    Dim mail As mailitem
    Dim txtDriverPhoneE As String
    Dim txtAssetRegE As String
    Dim txtServiceTypeE As String
    Dim txtGarageE As String
    Dim txtServiceDateE As String
    txtDriverPhoneE = Me.txtDriverNum
    txtAssetRegE = Me.txtReg
    txtServiceTypeE = Me.txtServiceType
    txtGarageE = Me.txtGarage
    txtServiceDateE = Me.txtDateOfService
    Set o = CreateObject("Outlook.Application")
    Set mail = o.CreateItem(olMailItem)
    mail.To = txtDriverPhoneE & "@esendex.net"
    mail.Subject = "Vehicle Service"
    mail.Body = "FYI - " & txtAssetRegE & " , is booked in for " & txtServiceTypeE & " Service @ " & txtGarageE & " on " & txtServiceDateE
    mail.Send
    Set o = Nothing
    Set mail = Nothing
End Sub
 
bubba100

Thanks for the response.
I have tried that but it still keeps the focus on Outlook, I could be wrong, but I think it may be something to do with Outlook Securtity Warning Message which take the focus away from Access to Outlook.
 
Thanks for our help guys.

I have solved my own problem.

I used
Code:
AppActivate ("DB Name")

And it works perfectly.

Cheers

Barney
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top