Error: User-Defined type not defined

bluedemon186

Registered User.
Local time
Today, 09:10
Joined
Dec 7, 2011
Messages
20
Hello,

I have been getting this error for the below code which is for a command button. It generates and email in Outlook with data from the fields in the form "frm_rush". It used to work great on another work station, but when I created a new database on a different machine, it started giving me this error.

References:
Visual Basic for Applications
Microsoft Access 14.0 Object Library
OLE Automation
Microsoft Office 14.0 Access database Engine Object

I even tried to add Microsoft DAO 3.6 Object Library, but it gave me the error "Name conflicts with existing module, project, or object library"


Code:
Private Sub Command26_Click()
DoCmd.RunCommand acCmdSaveRecord
Me!Time_Sub = TimeValue(Now)
If MsgBox("Do you want to submit this rush request?" _
        , vbYesNo, "Submit Rush?") = vbYes Then
Dim olApp As Outlook.Application
Dim olMail As MailItem
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
With olMail
    .To = ""
    .Subject = "WOAH000 " & " " & [Forms]![frm_rush]![WOAH]
    .Body = "Hello," & vbCr & vbCr & _
    "Please advise if the above work order can be rushed as " & [Forms]![frm_rush]![Type] & "." & vbCr & vbCr & _
    "Drying Instructions " & [Forms]![frm_rush]![Dry_ins] & vbCr & vbCr & _
    "Tests Requested: " & [Forms]![frm_rush]![Customer_Contact] & vbCr & vbCr & _
    "Regards, " & vbCr & _
    [Forms]![frm_rush]![Submitted_by]
    .Display
End With
Set olMail = Nothing
Set olApp = Nothing
        Else
            DoCmd.RunCommand acCmdUndo
    End If
 
End Sub
 
You need a reference to Outlook.
 
Can you please advise what reference would that be?
 

Users who are viewing this thread

Back
Top Bottom