StarScream
Technical User
Automatically Sending Outlook Email By Clicking A Button in an Access 2000
Scenario: Trying to have a button send an email using some information from a form, some information as part of the code.
Here is what I have so far. Can't seem to get it to work.
I keep getting a error everytime. Where is my error? Thanks.
PJ
Scenario: Trying to have a button send an email using some information from a form, some information as part of the code.
Here is what I have so far. Can't seem to get it to work.
Code:
Private Sub CmdSend_Click()
Dim olapp As Object
Dim oitem As Object
Set mSubject.Value = "You Have Mail!"
Set mBody.Value = "Message information."
Set ComBcc.Value = ""
Set ComCc.Value = ""
Set ComTo.Value = "pajamas94@home.com"
Set olapp = CreateObject("Outlook.Application")
Set oitem = olapp.CreateItem(0)
With oitem
.Subject = mSubject
.To = ComTo.Value & ";"
.Body = mBody
If ComCc.Value <> "" Then
.cc = ComCc.Value & ";"
End If
If ComBcc.Value <> "" Then
.bcc = ComBcc.Value & ";"
End If
.Send
End With
Set olapp = Nothing
Set oitem = Nothing
Unload Me
End Sub
I keep getting a error everytime. Where is my error? Thanks.
PJ