Load the Sample Access Project | |
The sample tables, forms, and procedures for this article reside in a single Access project and an MSDE database file. Several additional sample forms and procedures are also available in the Access project (download this project here). Because MSDE actively manages its database files, the installation process is inherently more complicated than with Jet solutions.
Copy the Access project, vbpjmsde.adp, to whatever folder you want to use to launch the project. Then, copy the database file, vbpjmsdesql.mdf, to the \Mssql7\Data folder of the drive you installed MSDE on. This file resides in Module1 within the Access project. Next, attach the database file to the local MSDE with a database name of vbpjmsde (see Listing 2). If that name already exists, update the procedure in Listing 2 to reference a new, unused database name. The procedure traps this error and prints a message suggesting an appropriate response. The procedure relies on the SQL DMO library to manage the local MSDE. First, it uses the CreateFunction statement to reference the SQLServer object. Second, it connects to the local server with the sa login. If this login has a password (as it definitely should), update the procedure to reflect it. Next, the procedure uses the AttachDBWithSingleFile method for the SQLServer object to attach the vbpjmsdesql.mdf file to the server. The method returns a message indicating the success of its attempt. After connecting the database file to the server, you still need to connect the Access project to the new database on the server. You can do this with the Data Link Properties dialog for the sample Access project. Open this dialog with the File | Connection command from the Database window. |