I have some old foxpro 2.6 tables which need to be linked to my access db in code.
I have an ado connection string which works for me to access the tables:
"Provider=vfpoledb;" & "Data Source=W:\testf;" & _
"Mode=ReadWrite|Share Deny None; Collating Sequence=Machine; Password=''"
Can I use this string to link the foxpro tables into the database?
Here is the code I am using now to link them using the dbaseIV
___________________________________________________
Function LinkdBaseFile(strPath As String, _
strLinkPro As String, strRemTab As String)
Dim conn As New ADODB.Connection
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
' Open the catalog using the current Access database.
cat.ActiveConnection = CurrentProject.Connection
' Create the new table.
tbl.Name = strRemTab
Set tbl.ParentCatalog = cat
' Set the properties to create the link.
tbl.Properties("Jet OLEDB:Create Link") = True
tbl.Properties("Jet OLEDB:Link Datasource") = "W:\testf"
tbl.Properties("Jet OLEDB:Link Provider String") = "Dbase IV;Null=No;Deleted=No;"
tbl.Properties("Jet OLEDB:Remote Table Name") = "Test"
' Append the table to the tables collection of the catalog.
cat.Tables.Append tbl
' Clean up.
Set cat = Nothing
End Function
_________________________________________
I have tried replacing the link provider string with my connection string but it doesn't work.
Thanks.
I have an ado connection string which works for me to access the tables:
"Provider=vfpoledb;" & "Data Source=W:\testf;" & _
"Mode=ReadWrite|Share Deny None; Collating Sequence=Machine; Password=''"
Can I use this string to link the foxpro tables into the database?
Here is the code I am using now to link them using the dbaseIV
___________________________________________________
Function LinkdBaseFile(strPath As String, _
strLinkPro As String, strRemTab As String)
Dim conn As New ADODB.Connection
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
' Open the catalog using the current Access database.
cat.ActiveConnection = CurrentProject.Connection
' Create the new table.
tbl.Name = strRemTab
Set tbl.ParentCatalog = cat
' Set the properties to create the link.
tbl.Properties("Jet OLEDB:Create Link") = True
tbl.Properties("Jet OLEDB:Link Datasource") = "W:\testf"
tbl.Properties("Jet OLEDB:Link Provider String") = "Dbase IV;Null=No;Deleted=No;"
tbl.Properties("Jet OLEDB:Remote Table Name") = "Test"
' Append the table to the tables collection of the catalog.
cat.Tables.Append tbl
' Clean up.
Set cat = Nothing
End Function
_________________________________________
I have tried replacing the link provider string with my connection string but it doesn't work.
Thanks.