Error 13 Type Mismatch

  • Thread starter Konchetta via AccessMonster.com
  • Start date
K

Konchetta via AccessMonster.com

I have the following code behind a command button on my form that is giving
me the Error 13 Type Mismatch on the following line: Dim outobj As Outlook.
Application...I'm trying to have dates entered in Access 2007 to update to
the Outlook Calendar. Not sure if it's my references or if this can actually
be done..just a little Access peon, not a programmer!!

Here is the code:
Private Sub AddAppt_Click()
On Error GoTo AddAppt_Err
' Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
' Exit the procedure if appointment has been added to Outlook.
If Me!AddedToOutlook = True Then
MsgBox "This appointment already added to Microsoft Outlook"
Exit Sub
' Add a new appointment.
Else
Dim outobj As Outlook.Application
Dim outappt As Outlook.AppointmentItem
Set outobj = CreateObject("outlook.application")
Set outappt = outobj.CreateItem(olAppointmentItem)
With outappt
.Start = Me!ApptDate & " " & Me!ApptTime
.Duration = Me!ApptLength
.Subject = Me!Appt
If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes
If Not IsNull(Me!ApptLocation) Then .Location = _
Me!ApptLocation
If Me!ApptReminder Then
.ReminderMinutesBeforeStart = Me!Reminderminutes
.ReminderSet = True
End If
.Save
End With
End If
' Release the Outlook object variable.
Set outobj = Nothing
' Set the AddedToOutlook flag, save the record, display a message.
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
AddAppt_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub
 
K

Konchetta via AccessMonster.com

Thanks Mr. Steele..It was my references. I saw that from an old post you gave
to someone needing help with the same thing. I have it working now but now I
am trying to figure out how to delete the appointment from the Outllook
Calendar when it is deleted from Access 2007. I saw some code but I am of
course a novice and could not understand. But thanks again for responding to
my post.
What references DO you have?
I have the following code behind a command button on my form that is giving
me the Error 13 Type Mismatch on the following line: Dim outobj As
[quoted text clipped - 44 lines]
Exit Sub
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top