17.2. Controlling the Logon Process

The only way to deftly handle logon errors when your application starts is by controlling the logon process to the back-end database. Sometimes the database server is down or there are network connectivity issues. If you don't control the connection process upon startup, then users may get a very unpleasant and confusing error message. Additionally, if you control the logon process then you can store the supplied username and password information for connecting to the same data store subsequently without having to re-ask the user for security credentials. The process and code needed will vary depending on whether you are using an ADP or MDB file

17.2.1. Using Linked Tables with MDB Files

If you don't have a custom startup form with an MDB file when using linked tables, then you can't control the logon process. If your application uses SQL Security, then your users may get prompted for passwords at random points in the application when Access first tries to use a given linked table. It is easy to create a custom startup login form that looks similar to the one shown in Figure 17-20 and prompts for username and password.

Using this simple form, you can then run code for the Next button to refresh the table links, save the username and password to global variables, or whatever your specific application needs to do. In the case of linked tables, you will likely need code at some point to create a DSN to store connection information for the tables. ...

Get Access 2003 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.