ADO DefaultDatabase Property

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO DefaultDatabase Property

The DefaultDatabase property sets or returns a string value that is the default database for a specific server-side connection.

This property cannot be used with a client-side connection (Remote Data Service). Even if a default database is set, you may still open connections that access other databases.
 

Syntax

objconn.DefaultDatabase

 
This example opens the Chants table in the N
orthwind database:

Example

Dim conn As ADODB.Connection
Dim rs As Recordset

Set conn = New ADODB.Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.DefaultDatabase="Material_Master"
Set rs = New ADODB.Recordset
rs.Open "tblAMSEA",conn
....
rs.Close
conn.close