O'Reilly logo

Access 2003 VBA Programmer's Reference by Armen Stein, Graham Seach, Teresa Hennig, Patricia Cardoza

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required