Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding a record in Access through VBA

Status
Not open for further replies.

cthaxter

Programmer
Aug 2, 2001
71
US
I'm having trouble getting the Find or FindFirst methods to work in Access 2000.

Here's what I'm doing. I'm comparing the items in my Outlook calendar with a table in Access, where both of them have similar fields, and I'm using the EntryID field to compare them. However, when I run the code, I get an error at the line in bold below, of "Operation is not supported for this type of object."

However, the FindFirst method does appear in the list of methods and properties whenever I type
rsCalendar.

So, why is that error occurring? Any help would be appreciated. Here's my code snippet:


Dim objOlApp As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objCalendar As Outlook.MAPIFolder
Dim objCalendarItems As Outlook.Items
Dim rsCalendar As DAO.Recordset
dim objAppointment as Outlook.AppointmentItem

Set objOlApp = CreateObject("Outlook.Application")
Set objNameSpace = objOlApp.GetNamespace("MAPI")
Set objCalendar = objNameSpace.GetDefaultFolder(olFolderCalendar)
Set objCalendarItems = objCalendar.Items

Set rsCalendar = CurrentDb.OpenRecordset("Calendar")
rsCalendar.MoveFirst

For Each objAppointment In objCalendarItems
rsCalendar.FindNext "EntryID = '" & objAppointment.EntryID & "'"
If Not rsLHDCalendar.EOF Then
MsgBox "Found appointment for " & objAppointment.Subject & _
" on " & objAppointment.Start " in Calendar table."
Else
MsgBox "No entry found for " & objAppointment.Subject & _
" on " & objAppointment.Start " in Calendar table."
End If
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top