start secure database with a user selected username

Jhitch

Registered User.
Local time
Today, 21:55
Joined
Nov 26, 2002
Messages
42
I have a secured database with 4 users ie admin, office, guest etc. I would like the user to be able to select from a list of the above and then automatically open the secured datebase with the selected user ie "/user office".

I have gone someway towards it with a seperate dbase containing a form with a list box of usernames. I have used Mile-O-Phile's example code to startup a seperate dbase, which works but only without any command line options. I cannot work out how to pass the command line option "/user ???" to the sub. Any suggestions?
 
This is how it would like look with actual values. You just need to replace the right parts with the values from your text boxes if the data is stored in a bound form.

Call Shell("C:\Program Files\Microsoft Office\Office97\msaccess.exe /wrkgrp X:\YourWorkgroupFile.mdw X:\Yourdatabasefile.mdb /user YourUserName /pwd YourPassword", vbNormalFocus)

Just remember to correctly enclose the strings with double quotes and no quotes for the variables. Do not forget about the 'spaces' between each piece.
 
It worked, thanks

Thank you for that - it put me on the right track. I had to make a variable to construct the string in the format you showed and it works fine. Here is what i did. Thanks once again.

Dim UserName, StringCall As String
UserName = Forms!frmlogon!List0.Value
StringCall = "C:\Program Files\Microsoft Office\Office\msaccess.exe /wrkgrp f:\simscopy\stnick.mdw F:\simscopy\securetest.mdb /user " & UserName & " " & "/pwd, vbNormalFocus"
Call Shell(StringCall)
 

Users who are viewing this thread

Back
Top Bottom