• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 30. Working with ADO Recordsets,... > Porting frmComboVBA to an Access Dat...

Porting frmComboVBA to an Access Data Project

The SQL statements that fill the combo and list boxes of frmComboVBA no longer include Jet-specific syntax, such as CCur or Format. Formatting the Row Source property of value lists also eliminates the need to use the Transact-SQL CONVERT function for formatting when connecting to MSDE. Thus it's easy to alter the Connection properties to port frmComboVBA to MSDE or SQL Server 6.5+, taking advantage of ADP's CurrentProject.Connection property.

  1. Open a new project (Existing Database) named OrdersByProductAndCountryVBA.adp in the folder in which you created ADO_VBA.mdb.

  2. In the Data Link Properties sheet, type (local) as the Server Name, sa as the User Name, and select NorthwindCS as the Database.

  3. Click Test Connection and click OK to create the default connection.

  4. Choose File, GetExternalData, Import; select ADO_VBA.mdb; and import frmComboVBA.

  5. Test frmComboVBA with the existing connection using the Jet OLE DB provider.

  6. In the VBA Editor, delete the WithcnnNwindEnd With statements in the Form_Load event handler.

  7. Change the Set .ActiveConnection = cnnNwind line to

    Set .ActiveConnection = CurrentProject.Connection
  8. Start MSDE, if necessary, with SQL Service Manager.

  9. Return to Access and click the View button twice to rerun the Form_Load event handler to test the new connection to the NorthwindCS MSDE database.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint