Version: Access 97
I am trying to implement an e-mail module into my Access DB. I have followed all the samples from various sites, but I am still missing something. When I run the code shown below, I receive the message:
Compiler Error: User-defined type not defined.
The error lined indicated is:
Dim objOutlook As Outlook.Application
I think I am missing an include, special module, etc., but I can't figure it out. The really frustrating part is that I have done it before in other projects, but now I am stumped. I would appreciate any help you can give.
My test code is listed below. Thanks in advance.
Bob Hall
rfhall50@cox.net
I am trying to implement an e-mail module into my Access DB. I have followed all the samples from various sites, but I am still missing something. When I run the code shown below, I receive the message:
Compiler Error: User-defined type not defined.
The error lined indicated is:
Dim objOutlook As Outlook.Application
I think I am missing an include, special module, etc., but I can't figure it out. The really frustrating part is that I have done it before in other projects, but now I am stumped. I would appreciate any help you can give.
My test code is listed below. Thanks in advance.
Bob Hall
rfhall50@cox.net
Code:
Option Compare Database
Option Explicit
Sub GettingFrustrated()
'******begin code******
Dim email, ref, origin, destination, notes As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
'**gathers information from your form. this sets the string variable to your fields
email = "rfhall50@cox.net"
ref = "Testing"
notes = "Just running a test."
'***creates an instance of Outlook
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
'***creates and sends email
With objEmail
.To = email
.Subject = ref
.Body = notes
.Send
End With
'**closes outlook
Set objEmail = Nothing
objOutlook.Quit
End Sub