Supplying Connection Information for Opening
an External Table

When you open an external table directly, you must supply a database path and a source database type as arguments in the OpenDatabase method. The source database name argument, dbname, is described in detail in the next section, “Specifying Database Names.”

The following code fragment assumes you want to connect to the FoxPro 3.0 database named Sales:

Set dbs = OpenDatabase("C:\JetBook\Samples\FoxTables\Sales", _
	False, False, "FoxPro 3.0")

In general, you can use the following methods and properties in VBA code to specify connection information:

For examples illustrating how to supply connection information for opening an external table, see the “Putting It All Together: Building a Connection String” section later in this chapter.