strange error linking tables 
Author Message
 strange error linking tables


I have a module that loops through a directory and links all .dbf tables
into an Access database.  For some reason, when I attempt to add the table
to the ADOX.Catalog, I get a 'invalid argument' error.  To the best of my
knowledge, this particular block of code hasn't been changed in a while, so
I'm surprised to see it not working right now.  The suspect code is pasted
below, with a comment at the line that fails.  Any pointers are most

Thanks in advance!

Private Sub SetLinkTblProperties(LinkDBFDir As String, TableName As String)
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table

If TableName = "" Then
  Exit Sub
End If

On Err GoTo Err_LinkDBF

Set cat = New ADOX.Catalog
Set tbl = New ADOX.Table

'Open the catalog
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
App.Path & "\WinPos.mdb;"

'set name and target catalog for linked table
tbl.Name = TableName
Set tbl.ParentCatalog = cat

'set properties to create link
tbl.Properties("Jet OLEDB:Create Link") = True
tbl.Properties("Jet OLEDB:Cache Link Name/Password") = False
tbl.Properties("Jet OLEDB:Remote Table Name") = TableName & "#dbf"
tbl.Properties("Jet OLEDB:Link Provider String") = "dBase 5.0;HDR=NO;IMEX=2"
tbl.Properties("Jet OLEDB:Link Datasource") = LinkDBFDir
tbl.Properties("Jet OLEDB:Exclusive Link") = False
tbl.Properties("Jet OLEDB:Create Link") = True
tbl.Properties("Jet OLEDB:Table Hidden In Access") = False

'Append table to collection
cat.Tables.Append tbl   '<---Failure occurs here!

Set cat = Nothing
Set tbl = Nothing

Exit Sub

  MsgBox ("Error linking table " & TableName & vbCrLf & _
         "Error text: " & Err.Description)

Set cat = Nothing
Set tbl = Nothing

End Sub

Sat, 05 Jun 2004 15:56:26 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Strange ODBC errors using DAO to access linked tables

2. Changing the linked table path without the linked table manager

3. Strange Strange Error

4. error VBA and Linked Tables because of split

5. Run-time error '3011' linking table

6. Recordset Object Error with Linked Table

7. Error 64508 When Using Linked Tables

8. Linked FoxPro table: Error 3078 when app installed

9. 32bit Crystal Reports error reporting links in 3 table database

10. Insert statement error on linked Access table

11. ADO - Error querying linked database tables in ACCESS 2000

12. read write error when attempting to write to dbo_tblCounts (Access linked table)


Powered by phpBB® Forum Software