I'm resending this since my last response didn't appear to go through...
Hi Svetlana,
The only way to do this would be to control the login process
programmatically. The SA user comes up because that is the account that
was likely used to create the initial connection for the ADP and so that
info is stored in the file's connection properties.
There are a couple of different steps to solving your problem. The first
is to use a custom logon form and perform the connection yourself using the
currentproject.openconnection method. This will replace any existing
connection info with that of the new connection info.
Secondly, for your own code to run without getting prompted by Access'
built-in login prompt, you will need to clear the connection info before
closing the application so that the app opens in a disconnected state the
next time around. This is done by passing a blank connection argument for
the openconnection method, as follows:
currentproject.openconnection ""
I usually hide the initial login form after I'm done with it and then have
this code run in the close event of the login form. The next time the app
is opened, your code can prompt the user for security credentials. However,
if you want to pre-populate the userid with the id of the last user, then
you will need to store and retrieve the data yourself because it will be
lost when the connection information is cleared upon closing the
application. One way to do this would be to add a custom property to the
currentproject object. Your code could then set this property after a user
has successfully logged on and retrieve the info upon startup.
I hope this helps,
Brian M. Sockey
www.farsightsolutions.com
www.televantagenorthwest.com