Establishes the user ID and password for protected (security-enabled) Microsoft Access databases. If you are not using a protected database, this statement is ignored.
SetDefaultWorkspace username, password
The SetDefaultWorkspace statement has these parts:
username A string expression identifying a user recognized by the system database.
password A string expression that is a valid password for username.
If you use protected databases, this statement must be the first data access statement used when running your program (except for SetDataAccessOption with the DB_INITPATH option setting). Initializing a data control or the use of any other data access function or statement will establish a default username of "Admin" and a default password of an empty string (""). Subsequent attempts to set or change the username or password are ignored.
You can access several databases while your application is running, but all protected databases must recognize the same username and password, since they can't be changed once established. The only way to change these settings is to exit your application and run it again with different settings.
If you use a protected database, you must include a copy of the system database with the appropriate settings when you distribute your application. Using this statement without a system database will produce an error. The system database must be in the current directory or in the directory specified in your application's initialization file (.INI). If you use a data control and must use the SetDefaultWorkspace statement, you must use it in the Sub Main procedure, or in the first Form_Load event procedure.
Note Only Microsoft Access can create a system database.