Trying to read an Appointment from Outlook

Richard M

Registered User.
Local time
Today, 13:40
Joined
Sep 29, 2010
Messages
75
I have a customer that wants to see the daily appointments from Outlook.

I got so far and then I get messages that says "Object dosen't support this property or method" The problem occures in the "rs(.." statements. I have not found any help relating to this problem. If there is, please point me to them.

Working with Office 2007 and windows XP.

Code:
Function showCalendar(strAns1)
Code:
[COLOR=black][FONT=Verdana]Dim ol As Object[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Dim olns As Object[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Dim objFolder As Object[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Dim objAllAppointment As Object[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Dim objRecurPattern As Object[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Dim db As Database, rs As Recordset[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Dim Appointment As Object[/FONT][/COLOR]
 
[COLOR=black][FONT=Verdana]Dim objOutlook As Outlook.Application[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Dim objAppt As Outlook.AppointmentItem[/FONT][/COLOR]
[COLOR=red][FONT=Verdana]'Dim objRecurPattern As Outlook.RecurrencePattern[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set objOutlook = CreateObject("Outlook.Application")[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set objAppt = objOutlook.CreateItem(olAppointmentItem)[/FONT][/COLOR]
[COLOR=red][FONT=Verdana]Set objRecurPattern = objOutlook.CreateItem(olAppointmentItem)[/FONT][/COLOR]
 
[COLOR=black][FONT=Verdana]'set up database to receive tasks[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set db = CurrentDb[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set rs = db.OpenRecordset("tblShowAllOutlookTasks", DB_OPEN_DYNASET)[/FONT][/COLOR]
 
[COLOR=black][FONT=Verdana]' Set the Application object.[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set ol = New Outlook.Application[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]' Set the Namespace object.[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set olns = ol.GetNamespace("MAPI")[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]'Set the default appointment folder.[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set objFolder = olns.GetDefaultFolder(olFolderCalendar)[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]' Set objAllTasks equal to the collection of all Tasks.[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set objAllAppointment = objFolder.Items[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]' Loop through each Appointment.[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]For Each Appointment In objAllAppointment[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]If Appointment.Categories = "CBBEP" Then[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs.AddNew[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("ProjectManagerID") = strAns1[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("typeofrecord") = "A"[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("olsubject") = Appointment.Subject[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("olstartdate") = Appointment.Start[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("olduedate") = Appointment.End[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("olreminderonoff") = Appointment.ReminderSet[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("Aduration") = Appointment.Duration[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("Aalldayevent") = Appointment.AllDayEvent[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("alocation") = Appointment.Location[/FONT][/COLOR]
[COLOR=red][FONT=Verdana]rs("arecurrencetype") = Appointment.RecurrencePattern.RecurrenceType[/FONT][/COLOR]
[COLOR=red][FONT=Verdana]rs("apatternEnddate") = Appointment.PatternEndDate[/FONT][/COLOR]
[COLOR=red][FONT=Verdana]rs("patternstartdate") = Appointment.PatternStartDate[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("AIsRecurring") = Appointment.IsRecurring[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("AReminderMinutesBeforeStart") =  Appointment.ReminderMinutesBeforeStart[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("AReminderTime") = Appointment.ReminderTime[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]rs("olnotes") = Appointment.Body[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]rs("olpriority") = Appointment.Importance[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]rs.Update[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Else   'donothing[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]End If[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Next[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set rs = Nothing[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set db = Nothing[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]End Function[/FONT][/COLOR]

Thanks,

Richard
 
Seems to me you have a lazy customer with plenty of money. Why can't they simply look in Outlook directly, that's what it is there for insn't it?
 
My customer wants to have the all the current appointments from outlook show in a popup dialog box when their Access program opens. I have the Task worked out and they can see all their Tasks.

I tried to link Outlook to Access and I get the table but not the information I am looking for. My goal is to see the appointments and edit if needed and update Outlook. The last one is to create an appointment right from Access. By the way, this is now working for Tasks (thanks darbid for the help).

but how does this work within my code?
You sent:
Set myItem = myOlApp.CreateItem(olTaskItem)
Set myPattern = myItem.GetRecurrencePattern
myPattern.RecurrenceType = olRecursMonthly

Why not have ".createitem(olAppointmentItem)"?

It looks like I am going to have to test for (daily, weekly, monthly etc), is that correct?
Can you tell me where I can find if this is text or numbers?

I take it that the last line is rs("arecurrencetype").RecurrenceType = olRecursMonthly to get it in my table?

Richard:confused:
 
Seems to me you have a lazy customer with plenty of money. Why can't they simply look in Outlook directly, that's what it is there for insn't it?

Absolutely.

In fact, why not just tell them to remember what they're supposed to be doing? Why should they get to use Outlook, when they have a brain?
 
Widmerpool,

In fact, why not just tell them to remember what they're supposed to be doing? Why should they get to use Outlook, when they have a brain?

The customer is using my project management program and wants to see and update tasks and appointments related to projects.

I had this working in Access 2003. But when the customer upgraded to Access 2007, it would not work. Here is the funny part of the problem. It works on my Access 2007. The they are missing some files in References. I have not been able to find those files and could not upload the ones from my Access 2007.

Still looking for a solution.

Richard
 
why can't you upload the files from you Access 2007?
you'll probably have to register these files too.

I use InoSetup to setup my app. It can copy files and register them if required
 
Hey Richard if you need help then ask. But you'll need to give lots more details. What you have said so far does not make sense as I think you realize.
 
I re-read my repley and it does not make too much since to me. I will post the libraries that I need on the other compters. I will also be looking at how to register them.

Thanks for your patients.

Richard
 

Users who are viewing this thread

Back
Top Bottom