Linking a dBase III table to an Access 2000 database - won't open 
Author Message
 Linking a dBase III table to an Access 2000 database - won't open

Based on the examples provided by Microsoft, I used the code reproduced
below in a VB6 SP3 project to try to attach a dBase III table to an Access
2000 database.  The file attaches, but the table will not open.  An SQL
statement run to select from it produces the error message: " is not a valid
name.  (That " is a Chr(34) and is part of the error message.)  When I try
to attach a dBase III table to an Access 2000 database directly from Access
using the Wizard, I get to the frame for identifying an index, click cancel
(there is none) and the same type of error message appears with the strange
" (Chr(34).  At one point I generate an error message about "langref"
required for HH_GET_WIN_TYPE (that's when I attach the table using the
following code, and then try to open the table directly from Access).

Could someone please help.  I've searched MSDN and read everything I can
find with no luck.

See http://www.*-*-*.com/

Sub ADOCreateAttachedJetTable()
  Dim cat As New ADOX.Catalog
  Dim tbl As New ADOX.Table
  Dim sLink As String
  Dim sPath As String
  Dim sName As String

  On Error GoTo AttachErr

  ' Open the main catalogue
  cat.ActiveConnection = gsInitString

  ' Set name and catalog for the table to be attached
  tbl.Name = gsFile
  Set tbl.ParentCatalog = cat

  ' Set the properties to create the attachment/link
    tbl.Properties("Jet OLEDB:Create Link") = True

    frmDataType.Caption = "Select type"
    frmDataType.Show vbModal

    If Len(fMainForm.dlgCommonDialog.FileName) > 0 Then
        sPath = fMainForm.dlgCommonDialog.FileName
        sName = MakeTableName(sPath, False)
        sPath = StripFileName(sPath)
        tbl.Properties("Jet OLEDB:Link Datasource") = sPath
        Set tbl = Nothing
        Set cat = Nothing
        Exit Sub
    End If

  ' Specify link provider string
  Select Case gnDataType
    Case gnDT_MSACCESS
       sLink = ";"
    Case gnDT_PARADOX3X
       sLink = "Paradox 3.X;"
    Case gnDT_PARADOX4X
       sLink = "Paradox 4.X;"
    Case gnDT_FOXPRO26
       sLink = "FoxPro 2.6;"
    Case gnDT_FOXPRO25
       sLink = "FoxPro 2.5;"
    Case gnDT_FOXPRO20
       sLink = "FoxPro 2.0;"
    Case gnDT_DBASEIV
       sLink = "dBase IV;"
    Case gnDT_DBASEIII
       sLink = "dBase III;"
    Case gnDT_BTRIEVE
       sLink = "Btrieve;"
    Case gnDT_EXCEL50, gnDT_EXCEL40, gnDT_EXCEL30
       sLink = "Excel 5.0;"
    Case gnDT_SQLDB
       sLink = ";"
    Case gnDT_TEXTFILE
      sLink = "Text;"
    End Select

  tbl.Properties("Jet OLEDB:Link Provider String") = sLink

  tbl.Properties("Jet OLEDB:Remote Table Name") = sName

  ' Append the table to the main collection
  cat.Tables.Append tbl

Set tbl = Nothing
Set cat = Nothing
Unload frmDataType

Exit Sub
Set tbl = Nothing
Set cat = Nothing
End Sub

Tue, 29 Jan 2002 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Attaching a dBase III table to Access 2000 via ADO

2. dBase III access, won't work ????

3. VB# won't access dbase III file

4. can't access dbase III external database

5. Import dBase III files to Access 2000 with ADO

6. ADO link dBASE III table syntax

7. open dbase type dbase III

8. Converting dBase III tables -> SQL databases

9. ADO problem with database operations on dBase III tables

10. ADO problem with database operations on dBase III tables

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

12. saving Access Tables to dbase III file format


Powered by phpBB® Forum Software