Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 error message

Author  Topic 

notsosuper
Posting Yak Master

190 Posts

Posted - 2005-08-09 : 18:38:19
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
> occurred in WindowsApplication15.exe
>
> Additional information: Exception from HRESULT: 0x9CC401F3.
> and it occurs here dao = oApp.CreateObject("DAO.DBEngine.35")
> here the whole code.
> Dim rst
> Dim dao
> Dim wks
> Dim db
> Dim nms
> Dim fld
> Dim itms
> Dim itm
> Dim strAccessDir
> Dim objAccess
> Dim strFolder
> Dim fFound
>
> Dim oApp As Outlook.Application = New Outlook.Application
> Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
> Dim pf As Outlook.MAPIFolder = oNS.Folders("Public
> Folders").Folders("All Public Folders")
> Dim cContacts As Outlook.MAPIFolder = pf.Folders("Contacts")
> Dim itt As Outlook.ContactItem
> Dim strdbname
>
>
> objAccess = oApp.CreateObject("Access.Application")
> strAccessDir = objAccess.SysCmd(9)
> strdbname = strAccessDir & "Contacts.mdb"
>
> objAccess.Quit()
>
> 'Set up reference to Access database
> dao = oApp.CreateObject("DAO.DBEngine.35")
> wks = dao.Workspaces(0)
> db = wks.OpenDatabase(strdbname)
>
> 'Open Access table containing data to import into Outlook
> rst = db.OpenRecordset("tblCustomers")
> Dim RecCount = rst.RecordCount
> If RecCount = 0 Then
> MsgBox("No customers to import")
> Exit Sub
> Else
> MsgBox(RecCount, " customers to import")
> End If
>
> 'Set up the Outlook folder and items and iterate
> 'through the Access table, adding one contact item using
> 'the custom form for each Access record
> oNS = oApp.GetNamespace("MAPI")
> pf = oNS.Folders("Public Folders").Folders("All Public Folders")
> itm = pf.itms
>
>
> Do Until rst.EOF
>
> itm = itms.Add("IPM.Contact.Access Contact")
>
> 'Built-in Outlook properties
> If IsDBNull(rst.CustomerID) = False Then itm.CustomerID =
> rst.CustomerID
> If IsDBNull(rst.CompanyName) = False Then itm.CompanyName =
> rst.CompanyName
> If IsDBNull(rst.ContactName) = False Then itm.FullName =
> rst.ContactName
> If IsDBNull(rst.Address) = False Then itm.BusinessAddressStreet
> = rst.Address
> If IsDBNull(rst.City) = False Then itm.BusinessAddressCity =
> rst.City
> If IsDBNull(rst.Region) = False Then itm.BusinessAddressState =
> rst.Region
> If IsDBNull(rst.PostalCode) = False Then
> itm.BusinessAddressPostalCode = rst.PostalCode
> If IsDBNull(rst.Country) = False Then itm.BusinessAddressCountry
> = rst.Country
> If IsDBNull(rst.Phone) = False Then itm.BusinessTelephoneNumber
> = rst.Phone
> If IsDBNull(rst.Fax) = False Then itm.BusinessFaxNumber = rst.Fax
> If IsDBNull(rst.ContactTitle) = False Then itm.JobTitle =
> rst.ContactTitle
>
> 'Custom Outlook properties
> itm.UserProperties("Preferred") = rst.Preferred
> itm.UserProperties("Discount") = rst.Discount
> itm.Close(0)
> rst.MoveNext()
>
> Loop
> rst.Close()
> MsgBox("All contacts imported!")
>
> End Sub
>

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-08-09 : 20:04:21
Sounds like DAO is not installed....

http://msdn.microsoft.com/data
http://support.microsoft.com/kb/143292/EN-US/

Michael

<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>
Go to Top of Page

notsosuper
Posting Yak Master

190 Posts

Posted - 2005-08-10 : 12:53:26
I have searched that and it says if you have microsoft access which I have you have dao.
Go to Top of Page
   

- Advertisement -