Accessing an External Database Example
This example opens a Paradox database and uses the OpenTable function to open a Paradox table.
Sub OpenParadoxDb ()
Dim Db As Database, Tb As Table, Conn As String
Conn = "Paradox;" ' Specify database type.
' Open the database.
Set Db = OpenDatabase("C:\PARADOX", False, False, Conn)
Set Tb = Db.OpenTable("PARATBL.DB") ' Open Paradox table file.
...
End Sub
This example attaches a dBASE III table called Author in the C:\DATADIR directory to an existing Visual Basic database.
Sub AttachdBaseTable ()
Dim Db As Database, Td As New TableDef
Set Db = OpenDatabase("C:\VB\MYDB.MDB")
Td.Connect = "dBASE III;DATABASE=C:\DATADIR"
Td.SourceTableName = "AUTHOR.DBF" ' The name of the file.
Td.Name = "dbAuthor" ' The name in your database.
Db.TableDefs.Append Td ' Create the link.
...
End Sub