K
Kevin
I am trying to generate an automatic email after a users enter a record via a
form. I have the following code in the After Insert Event:
Private Sub Form_AfterInsert()
Set O = CreateObject("Outlook.Application")
Set m = O.CreateItem(0)
m.To = "Slezewski, Kevin"
m.Subject = "Finish Sample Request Entered"
m.Body = Chr(13) & "JobNumber"
m.display
End Sub
I currently get a Compile Error: Variable not defined and it highlights the
first "O =" in the code. I am not sure what variable I should be defining.
I don't even truly know if the rest of the code will achieve what I intend it
to, so any other suggestions are appreciated.
Also of note...I have it set to "display" the email only for the testing of
the code, but plan to change that to "send" when I implement. I believe I
should be using DoCmd.SendObject for that. As mentioned, any help is greatly
appreciated!
form. I have the following code in the After Insert Event:
Private Sub Form_AfterInsert()
Set O = CreateObject("Outlook.Application")
Set m = O.CreateItem(0)
m.To = "Slezewski, Kevin"
m.Subject = "Finish Sample Request Entered"
m.Body = Chr(13) & "JobNumber"
m.display
End Sub
I currently get a Compile Error: Variable not defined and it highlights the
first "O =" in the code. I am not sure what variable I should be defining.
I don't even truly know if the rest of the code will achieve what I intend it
to, so any other suggestions are appreciated.
Also of note...I have it set to "display" the email only for the testing of
the code, but plan to change that to "send" when I implement. I believe I
should be using DoCmd.SendObject for that. As mentioned, any help is greatly
appreciated!