O'Reilly logo

Access™ 2007 VBA Programmer's Reference by Armen Stein, Geoffrey Griffith, Rob Cooper, Teresa Hennig

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

19.3. Controlling the Logon Process

The elegant way to handle logon errors when starting a client-server application is to control the logon process to the back-end database. Undoubtedly the client-server application will run into network or database server connectivity issues at some point in its lifecycle. If the connection process is not controlled at startup, users may get an unpleasant and confusing error message, and it will be difficult to control reconnection in the same session if the network/server becomes disconnected. Controlling the logon process from the beginning makes it is quite easy to store the supplied username and password information for connecting to the data store subsequently without having to re-ask the user for security credentials. However, the process and code needed to log in can vary depending on whether an ADP or an ACCDB/MDB file format is used.

19.3.1. Using Linked Tables in ACCDB/MDB Files

A graceful way to control the login process is to create a startup form in the application to prompt the user for his credentials. If the application uses SQL Security and does not store user credentials explicitly, users may be prompted for credentials from the server when trying to read or manipulate objects in the application when Access first tries to use the table or view. Fortunately, it is easy to create a custom startup login form that looks similar to the one shown in Figure 19-16 and prompts for username and password.

Figure 19.16. Figure 19-16 ...

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