Update Outlook Appointment??? (1 Viewer)

Richard M

Registered User.
Local time
Today, 02:56
Joined
Sep 29, 2010
Messages
75
:mad: Pulling my hair out trying to update an appointment in Outlook. The code I am using stops running at this line.

Set objAppointmentItem = objAppointment.Items.Find("[Subject]=" & Forms!frmShowAllOutlookTasks_fromPopup_1!OLSubject)

this line and gives me an error code of -2147352567 Cannot parse condition. Error at "".

Debug shows me that the OLSubject is there but "Set objAppointmentItem = Nothing."

Using Access 2007

Can anybody tell me what I am going wrong?



Code:
Function UpdateOutlookAppointment()
On Error GoTo ErrorMsg
Dim objApp As Object
Dim objAppointmentItem As AppointmentItem
Dim objNS As NameSpace
Dim objAppointment As MAPIFolder
Dim objAppt As Object
Dim Subject As UserProperty
Dim RecordID As UserProperty
Dim taskID As UserProperty
Dim AppointmentType As UserProperty
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objAppointment = objNS.GetDefaultFolder(olFolderCalendar)
 
Debug.Print "first"
 
[COLOR=red]Set objAppointmentItem = objAppointment.Items.Find("[Subject]=" & Forms!frmShowAllOutlookTasks_fromPopup_1!OLSubject)[/COLOR]
 
Debug.Print "second"
Set objAppt = Forms![frmShowAllOutlookTasks_fromPopup_1]!OLSubject
Debug.Print "OK1"
Set AppointmentType = objAppointmentItem.UserProperties.Find(objAppt) '(objAppointmentItem)
Debug.Print "OK2"

Tanks for any help you can give me,

Richard M
 
Last edited:

spikepl

Eledittingent Beliped
Local time
Today, 09:56
Joined
Nov 3, 2010
Messages
6,142
debug.print "[Subject]=" & Forms!frmShowAllOutlookTasks_fromPopup_1!OLSubject
 

Richard M

Registered User.
Local time
Today, 02:56
Joined
Sep 29, 2010
Messages
75
spikepl, the print.debug just tells me that I get the OLSubject but the Set objAppointmentItem = Nothing. Still lost

Richard M
 

spikepl

Eledittingent Beliped
Local time
Today, 09:56
Joined
Nov 3, 2010
Messages
6,142
I did not ask for that for fun. Please paste the output of that here.
 

Richard M

Registered User.
Local time
Today, 02:56
Joined
Sep 29, 2010
Messages
75
The message I got from Immediate window is:

[Subject]=It is almost done
first
 

spikepl

Eledittingent Beliped
Local time
Today, 09:56
Joined
Nov 3, 2010
Messages
6,142
Imagine that. How is the poor thing to know what to look for? That is what Cannot parse condition means.

You are missing quotes to denote a WHOLE string. Add Chr(34) before and after the text of the subject
 

Richard M

Registered User.
Local time
Today, 02:56
Joined
Sep 29, 2010
Messages
75
Im not sure what you mean.

Set objAppointmentItem = objAppointment.Items.Find("[Subject]=" & Forms!frmShowAllOutlookTasks_fromPopup_1!OLSubject)

where do I place chr(34)?
 

Richard M

Registered User.
Local time
Today, 02:56
Joined
Sep 29, 2010
Messages
75
spikepl,

Played with the chr(34) some more and It works :D Thanks for helping me and now I can relax from the panic mode.

Richard
 

Users who are viewing this thread

Top Bottom