Access Query Result from Another Program

  • Thread starter Thread starter Jake
  • Start date Start date
J

Jake

I'm trying to access a query result from Outlook, and have
the following (the recordsets are used later):

Set dbe = objItem.Application.CreateObject
("DAO.DBEngine.36")
Set wks = dbe.Workspaces(0)
Set dbs = wks.OpenDatabase(strDBPath)
Set rs = dbs.OpenRecordset(strEmailTable)
Set rs2 = dbs.OpenRecordset(strAttachmentTable)

If dtReceivedTime = #12:00:00 AM# Then dtReceivedTime
= DLookup("MaxOfEmailReceived", "qryImportDT")

If I manually open the database (and leave it open) before
running the code, my If statement works fine. Otherwise,
I receive error 2950 (Reserved Error). Any ideas on how
to get this to work?

Thanks!
Jake
 
Back
Top