Timbo
12-03-2003, 11:28 PM
I've tried everything I can think of, and there's nothing on this on Google (that I can find) - everything refers to database files which have a nice simple full filepath.
Studying the properties of a manually created Outlook folder link, here are the differences between the 2 troublesome properties:
________________________________________________________
New Table Property: "Jet OLEDB:Link Provider String"
Outlook -
"Outlook 9.0;MAPILEVEL=Personal Folders;PROFILE=Microsoft Outlook Internet Settings;TABLETYPE=0;TABLENAME=TLE;"
Access -
"MS Access;Pwd=myLinkPassword"
where
"MAPILEVEL" is the parent folder tree to the desired folder to link
"TABLENAME" is the name of the actual folder to link to
________________________________________________________
New Table Property: "Jet OLEDB:Link Datasource"
Outlook -
"C:\DOCUME~1\HEADHO~1\LOCALS~1\Temp\"
Access -
App.Path & "\myLinkDatabase.mdb
As you can see, the Outlook 'Datasource' is a truncated path to the active profile's temp folder.
________________________________________________________
Some examples I've seen don't even include that argument - I've tried with and without, using the full path and the actual value as shown...
'creates a new linked table to the current database
Private Function LinkedTable_ADOXNew(ByVal strLinkProvider As String, _
ByVal strTableName As String) As Boolean
Dim catParent As ADOX.Catalog
Dim tblAppend As ADOX.Table
Const TBLPROPERTY_LINKED As String = "Jet OLEDB:Create Link"
Const TBLPROPERTY_PROVIDER As String = "Jet OLEDB:Link Provider String"
Const TBLPROPERTY_NAME As String = "Jet OLEDB:Remote Table Name"
Const TBLPROPERTY_SOURCE As String = "Jet OLEDB:Link Datasource"
On Error GoTo ErrorH
LinkedTable_ADOXNew = False
'create refernce to Current Db
Set catParent = New ADOX.Catalog
catParent.ActiveConnection = CurrentProject.Connection
Set tblAppend = New ADOX.Table
'assign table properties
With tblAppend
.Name = strTableName
Set .ParentCatalog = catParent
.Properties(TBLPROPERTY_PROVIDER) = strLinkProvider
.Properties(TBLPROPERTY_NAME) = strTableName
.Properties(TBLPROPERTY_LINKED) = True
'##### - CHANGE ME TO FIT YOUR PROFILE'S "Local Settings\Temp\" FOLDER #####
.Properties(TBLPROPERTY_SOURCE) = "C:\DOCUME~1\HEADHO~1\LOCALS~1\Temp\"
End With
With catParent.Tables
.Append tblAppend
.Refresh
End With
LinkedTable_ADOXNew = True
Finish:
On Error Resume Next
Set tblAppend = Nothing
Set catParent = Nothing
Exit Function
ErrorH:
MsgBox Err.Description
Resume Finish
End Function
Of course it may be that it's not the property settings that are the problem :-\
Any advice gratefully recieved :)
Studying the properties of a manually created Outlook folder link, here are the differences between the 2 troublesome properties:
________________________________________________________
New Table Property: "Jet OLEDB:Link Provider String"
Outlook -
"Outlook 9.0;MAPILEVEL=Personal Folders;PROFILE=Microsoft Outlook Internet Settings;TABLETYPE=0;TABLENAME=TLE;"
Access -
"MS Access;Pwd=myLinkPassword"
where
"MAPILEVEL" is the parent folder tree to the desired folder to link
"TABLENAME" is the name of the actual folder to link to
________________________________________________________
New Table Property: "Jet OLEDB:Link Datasource"
Outlook -
"C:\DOCUME~1\HEADHO~1\LOCALS~1\Temp\"
Access -
App.Path & "\myLinkDatabase.mdb
As you can see, the Outlook 'Datasource' is a truncated path to the active profile's temp folder.
________________________________________________________
Some examples I've seen don't even include that argument - I've tried with and without, using the full path and the actual value as shown...
'creates a new linked table to the current database
Private Function LinkedTable_ADOXNew(ByVal strLinkProvider As String, _
ByVal strTableName As String) As Boolean
Dim catParent As ADOX.Catalog
Dim tblAppend As ADOX.Table
Const TBLPROPERTY_LINKED As String = "Jet OLEDB:Create Link"
Const TBLPROPERTY_PROVIDER As String = "Jet OLEDB:Link Provider String"
Const TBLPROPERTY_NAME As String = "Jet OLEDB:Remote Table Name"
Const TBLPROPERTY_SOURCE As String = "Jet OLEDB:Link Datasource"
On Error GoTo ErrorH
LinkedTable_ADOXNew = False
'create refernce to Current Db
Set catParent = New ADOX.Catalog
catParent.ActiveConnection = CurrentProject.Connection
Set tblAppend = New ADOX.Table
'assign table properties
With tblAppend
.Name = strTableName
Set .ParentCatalog = catParent
.Properties(TBLPROPERTY_PROVIDER) = strLinkProvider
.Properties(TBLPROPERTY_NAME) = strTableName
.Properties(TBLPROPERTY_LINKED) = True
'##### - CHANGE ME TO FIT YOUR PROFILE'S "Local Settings\Temp\" FOLDER #####
.Properties(TBLPROPERTY_SOURCE) = "C:\DOCUME~1\HEADHO~1\LOCALS~1\Temp\"
End With
With catParent.Tables
.Append tblAppend
.Refresh
End With
LinkedTable_ADOXNew = True
Finish:
On Error Resume Next
Set tblAppend = Nothing
Set catParent = Nothing
Exit Function
ErrorH:
MsgBox Err.Description
Resume Finish
End Function
Of course it may be that it's not the property settings that are the problem :-\
Any advice gratefully recieved :)