Susan Harkins
ssharkins at gmail.com
Mon Nov 12 11:04:21 CST 2007
I tried the code, after changing IMP to IPM, on a different system -- same error. Outlook library and OLE Automation are loaded. I'm using Office 2003, and I got IPM.Contact from the folder's properties -- should I be using another name or constant perhaps? Perhaps the Item object should be a Field object? I'll try that next, even though that doesn't quite make sense to me. Susan H. > >> In the following code, the Set itm = itms.Add("IMP.Contact") statement >> returns an object variable not set error. The Outlook library is >> referenced. Any help? >> >> Susan H. >> >> >> >> Dim itms As Outlook.Items >> Dim itm As Outlook.ContactItem >> Set cnn = CurrentProject.Connection >> rst.Open "tblContacts", cnn >> >> Set itm = itms.Add("IMP.Contact") >> >> With itm >> .CustomerID = Nz(rst!CustomerID) >> .FirstName = Nz(rst!FirstName) >> .LastName = Nz(rst!LastName) >> .Department = Nz(rst!Department) >> .Birthday = Nz(rst!Department) >> End With