|
||||||||||
| 12150 E. Briarwood Ave., Suite 202, Centennial, CO 80112 | ||||||||||
| (303)740-1999 Toll Free:(877)740-1999 | ||||||||||
Attach Data File
Download Now! |
||||||||||
|
The recommended practice for building database solutions in Microsoft Access is to place the program component (forms, queries, reports, etc.) in one file and the data in another, and "attach" the data file to the program file. The problem is that if the data file is moved, or the program file is moved so the path to the data is different, the attachments will become broken. The Attach Database tool helps
Access programmers solve this problem. This Access form, which you can place in your projects, makes it easy to re-attach to all of the tables in the data file by simply selecting the data file with the Open File dialog. Download this useful tool for free, and put this feature to use in your application.
The file you will download is a 2.9 MB Setup program. The Setup program is necessary to install two .ocx files, one containing the Microsoft Common Dialog control and the other with the Microsoft Common Controls. You can simplify your application, and do away with the Setup program, by removing the dialog control from the form and just having users type in the database path. After downloading, import the AttachDatabase form and Attachments module from the file you download into your Microsoft Access front end file. You can run the utility from your AutoExec macro or from another macro or routine by calling AdminStartup(). To attach to a data file, you can type the fully qualified path into the text box and click on Select Subset File. |
||||||||||
| An easier way to attach to the data file is to click on Select Subset File without entering any text in the text box. A dialog box like the one shown below will open. | ||||||||||
|
|
||||||||||
|
Browse for the data file that you wish to attach
to. Once you have clicked on
the data file that you wish to attach to, click on the Open
button. |
||||||||||
| The code in the Attachments module can easily be modified to suit your specific needs. For example, you can test whether your front end is already linked to a database by assigning the name of a specific table to the CheckTable variable in the AdminStartup routine. You can also add you own code to open a menu or specific form once the link to the desired database has been established. | ||||||||||
| If you would like to attach to a different data file, re-open the Attach Database form. Follow the instructions above, selecting the new database file name this time. | ||||||||||
|
||||||||||