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