Hi All
I have the following code entering appointments into outlook from a command click on an access form. I have managed to get it working perfectly on my home laptop, running Access 2007, when i ve transfered to my laptop i am getting the following error:
Error 438
Object doesn't support this property or method
ANyone have any ideas why it works on one not the other??
Private Sub Command158_Click()
On Error GoTo Add_Err
DoCmd.RunCommand acCmdSaveRecord
If Me!addedtooutlook = True Then
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmOutlookCheck"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit Sub
Else
Dim objOutlook As Object ' Outlook.Application
Dim objAppt As Object ' Outlook.AppointmentItem
Const olAppointmentItem = 1
Set objOutlook = CreateObject("Outlook.Application")
Set objAppt = objOutlook.CreateItem(olAppointmentItem)
With objAppt
.Start = Me!AppointmentDate & " " & Me!AppointmentTime
.Subject = Me![Name 1] & " - " & Me!AppointmentContact & " - " & Me![Sales District]
If Not IsNull(Me!PartnerID) Then .Location = "Customer Site -" & " " & Me!City
.Duration = Me.Text165
.Save
End With
Set objAppt = Nothing
End If
Set objOutlook = Nothing
Me!addedtooutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub
Many thanks
Ali
I have the following code entering appointments into outlook from a command click on an access form. I have managed to get it working perfectly on my home laptop, running Access 2007, when i ve transfered to my laptop i am getting the following error:
Error 438
Object doesn't support this property or method
ANyone have any ideas why it works on one not the other??
Private Sub Command158_Click()
On Error GoTo Add_Err
DoCmd.RunCommand acCmdSaveRecord
If Me!addedtooutlook = True Then
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmOutlookCheck"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit Sub
Else
Dim objOutlook As Object ' Outlook.Application
Dim objAppt As Object ' Outlook.AppointmentItem
Const olAppointmentItem = 1
Set objOutlook = CreateObject("Outlook.Application")
Set objAppt = objOutlook.CreateItem(olAppointmentItem)
With objAppt
.Start = Me!AppointmentDate & " " & Me!AppointmentTime
.Subject = Me![Name 1] & " - " & Me!AppointmentContact & " - " & Me![Sales District]
If Not IsNull(Me!PartnerID) Then .Location = "Customer Site -" & " " & Me!City
.Duration = Me.Text165
.Save
End With
Set objAppt = Nothing
End If
Set objOutlook = Nothing
Me!addedtooutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub
Many thanks
Ali