This documentation is archived and is not being maintained.

Visual Basic Reference

Visual Studio 6.0

DefaultType Property (Data Control)

See Also    Example    Applies To

Returns or sets a value which determines the type of data source (Jet or ODBCDirect) that is used by the Data control.


object.DefaultType [= value ]

The DefaultType property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
value An integer constant or value that specifies the type of data source, as described in Settings.


The settings for value are:

Setting Value Description
dbUseODBC 1 Use ODBCDirect to access your data.
dbUseJet 2 (Default) Use the Microsoft Jet database engine to access your data.


Setting the DefaultType property tells the Data control what type of data source (Jet or ODBCDirect) to use when creating a Recordset. The DefaultType property also determines the type of the underlying Workspace object used with the Data control. The Jet database engine will not be loaded unless this property is set to dbUseJet.

When setting the DefaultType property to dbUseODBC, Visual Basic creates a new Workspace object and adds it to the Workspaces collection. The DefaultType property of the Data control is similar to the type parameter of the CreateWorkspace method. When using dbUseJet, the default Workspace object is used.

Note   When you select dbUseODBC for the DefaultType property, DAO routes all data access operations through a Remote Data Objects (RDO) DLL.  Also, if you select "1 - UseODBC" in the DefaultType property in the property sheet, you must also specify an ODBC connect string in the Connect property box. To do this, select Text, then enter the ODBC connect string. For more information on ODBC connect strings, see the Visual Basic Data Access Guide.

Choosing a Data Source

Data Access Objects (DAO) can be programmed to connect to remote ODBC data sources in one of two ways: through the Jet database engine or through Remote Data Objects (RDO) which bypasses Jet completely. Depending on the features and performance you need, either approach might make sense for your particular application.

Using ODBCDirect: This approach permits you to use the Data control against remote ODBC data sources by routing all DAO operations through the RDO interface. That is, when you establish a connection and create a Recordset object using the Data control, the Jet database engine is not loaded or used in any way. This also means that many of the DAO features provided by the Jet engine are not available on this Workspace. For example, you cannot perform heterogeneous joins, or access ISAM on .mdb databases without use of additional ODBC drivers. However, when you choose ODBCDirect, many RDO features not ordinarily supported by Jet are enabled.

Using The Jet Database Engine: Unless you enable ODBCDirect, the Jet database engine is loaded and performs all local and remote database operations. Once a Jet Workspace is created, it cannot be used to pass data to an ODBCDirect Workspace.

Data Type