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

Sending email from Access using Outlook 2

Status
Not open for further replies.

fogcity

Programmer
Feb 8, 2008
8
US
I used information from the Microsoft web site and from this forum to write VBA code last week to send email from Access using Outlook. The code is run when a user clicks on a "Send" button on a form. It worked fine for a few days.

Now when a user clicks on the "Send" button they receive the following error message:
"Compile error: User-defined type not defined."

The code is stopping at the first Dim statement in the subroutine. Here's the beginning of the subroutine:

Code:
Private Sub sbSendAwardCompletionRequest(Optional AttachmentPath)
    Dim objOutlook As Outlook.Application
    Dim objOutlookMsg As Outlook.MailItem
    Dim objOutlookRecip As Outlook.Recipient
    Dim objOutlookAttach As Outlook.Attachment

I uploaded an upgrade for this application on Saturday so I think the problem is related to an upgrade I did on my system on Friday. As of this month I need to support both Access 2007 and Access 2003. On Friday I upgraded my system so that both versions of Microsoft Office are installed including Access although only Outlook 2007 is installed.

How do I change the code so that it compiles on my system and knows to look for Outlook 2003 on the user's sytem? Should I post the entire subroutine?

Deanna

 
You are probably missing a refence to Outlook Object Library in the database you are trying to execute the code from.

Open up the Visual Basic code then choose Tools -> References. Make sure the Outlook library is selected.
 
You need to look at your references and substitute the new Outlook library for the Outlook library marked MISSING.
 
grgimpy, Remou:

Thanks. I went back and checked Tools->References again before replying and found that I had mistaken the Office library for the Outlook library.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top