How to programmatically link Outlook Address book to Access Databa

B

Burton G. Wilkins

In MSDN, sample code is offered which fails at the very least because two
specified variables are undefined or misnamed. I would like assistance to
fix this code so it will worki.

"Create a Linked External Table" within the MSDN article "Working with
Tables in Microsoft Access"
(found at '
http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/dntaloc/html/office10052000.')
asserts in the Section entitled "Create a Linked External Table", that "The
following sample can be used to create a linked table for any I-ISAM or ODBC
data source." That code follows:

Sub CreateLinkedExternalTable(strTargetDB As String, _
strProviderString As String, _
strSourceTbl As String, _
strLinkTblName As String)

Dim catDB As ADOX.Catalog
Dim tblLink As ADOX.Table

Set catDB = New ADOX.Catalog
' Open a Catalog on the database in which to create the link.
catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & strTargetDB

Set tblLink = New ADOX.Table
With tblLink
' Name the new Table and set its ParentCatalog property
' to the open Catalog to allow access to the Properties
' collection.
.Name = strLinkTblAs
Set .ParentCatalog = catDB

' Set the properties to create the link.
.Properties("Jet OLEDB:Create Link") = True
.Properties("Jet OLEDB:Link Provider String") _
= strProviderString
.Properties("Jet OLEDB:Remote Table Name") = strLinkTbl
End With

' Append the table to the Tables collection.
catDB.Tables.Append tblLink

Set catDB = Nothing
End Sub

There are two obvious errors in this code. The variable "strLinkTblAs"
(used in the line which reads '.Name = strLinkTblAs') and the variable
"strLinkTbl" (used in the line which reads '.Properties("Jet OLEDB:Remote
Table Name") = strLinkTbl') are undefined. Also the functions parameters
"strSourceTbl" and "strLinkTblName" are never used.

Later down in the article, with in the section entitled "Link to an Outlook
or Exchange folder", this is stated: "you can use the
CreateLinkedExternalTable procedure to create a table that is linked to a
folder named "Big Project" that is a subfolder of the Inbox folder, then you
can name the linked table "LinkedExchange."

CreateLinkedExternalTable _
"C:\Program Files\Microsoft "
& "Office\Office\Samples\Northwind.mdb", _
"Exchange 4.0;MAPILEVEL=Mailbox - Pat " _
& "Smith|Inbox;TABLETYPE=0;" _
& "DATABASE=C:\Program Files\Microsoft " _
& "Office\Office\Samples\Northwind.mdb;", _
"Big Project","LinkedExchange"


When I pass these references to CreateLinkedExternalTable offered in MSDN,
the routine errors out.

I have tried to fix this procedure so that it works, but as yet nothing have
not succeeded. Does anyone have a correction so that this
"CreateLinkedExternalTable" process will function successfully? The optimum
solution would be able to link a table in an Access database to the "Global
Address List" within Outlook.

I would appreciate your response.

Sincerely,

Burton G. Wilkins
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top