Hi All
I have a form that has 3 different email fields and 3 buttons to open each of them. Problem is I have only one of them working the rest is kinda adapting the first ones event:/
when I am trying to set up the other buttons and I add the event procedure in properties the below code for the working button is already there with the same command, if I delete it and replace it, the other button stops working and so on. Would appreciate help. All I do is intuitive when it comes to this part of access and on a trial basis Am I adding the new event the wrong way? Should I do something else (talk in big letters to me about code and what to do in the VBA cus I have no clue!)
The below is the code for the working one, and works perfectly. Launches outlook and inputs the appropriate email address into the send to field:
Option Compare Database
Private Sub Command1215_Click()
Call Sendemail
End Sub
Sub Sendemail()
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
' prevent 429 error, if outlook not open
On Error Resume Next
Err.Clear
Set oOutlook = GetObject(, "Outlook.application")
If Err.Number <> 0 Then
Set oOutlook = New Outlook.Application
End If
Set oEmailItem = oOutlook.CreateItem(olMailItem)
With oEmailItem
.To = [OWNER EMAIL]
.Display
End With
Set oEmailItem = Nothing
Set oOutlook = Nothing
End Sub