Microsoft Office 2000 Developer |
To create a data source, you identify the database(s) required and create a connection for each database. The Data Environment designer makes this easy, because you can create one Connection object for each database and then add Command objects as needed. Each Command object corresponds to a recordset. After configuring the Data Environment designer with the required Connection and Command objects, the result is known as a DataEnvironment object.
Although the Date Environment designer has a more user-friendly environment for specifying connections to databases than some of the other data access options, it only works from a stand-alone project.
Note An extra step is involved in creating a data source with the DataEnvironment object. You must also package the resulting DataEnvironment object as a public object with public functions and properties. This is covered in greater detail in Creating a DataEnvironment Object for Use in a DLL File.
To create a Data Environment connection
See Inserting ActiveX Designers into a VBA Project for more information.
The Advanced tab allows you to set other parameters, such as Access user permissions.
The All tab allows you to review the initialization parameters for the database and change the settings if needed.
Once a connection has been established with a data provider, use the Data Environment designer to create Command objects. Each Command object represents a recordset from the database. If you are familiar with SQL (or Transact-SQL), you can create SQL statements that retrieve data from more than one table. If you are using Access, you can select a single table.
To add a Command object representing a database table
The names of all tables in the database will appear in the Object Name drop-down list.
To add a Command object using an SQL statement
SELECT ProductID, ProductName, UnitPrice FROM Products
For More Information More documentation about the Data Environment designer and hierarchical recordsets can be found in the Visual Basic documentation in the MSDN Library. See "About the Data Environment Designer" in the Data Access Guide.