Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO and Security

Status
Not open for further replies.

nickjar2

Programmer
Jun 20, 2001
778
US
Does anyone know a way around this? Here is a little code I have:

Set conn = New ADODB.Connection

With conn
.ConnectionString = CurrentProject.Connection
.Open
End With

The db is secure where users have to type in user id and password. The thing is, the currentproject.connection stores the USER ID, but no password, and therefore i get 'Not a valid account name of password". DAO was so much easier with set db = currentdb, but it will take me ages to convert back to DAO. Hopefully I am missing something. ADOX doesn't also have 2b used does it?

Cheers! Nick (Everton Rool OK!)
 
I use little ADo but I believe there is a dot command that will allow you to set the password. Is that what you need?
Like .password = XXXXX
 
My guess is you need to persist the security information when the user logs in. Use the UDL wizard and experiment with your connection. It will show all the options that can be set and their respective names. Their should be a way when the user logins to save the password for the duration of the session.

Here is how you invoke the udl wizard. Do this on your desktop.

1. create a blank notepad file.
2. save the file.
3. rename the file by adding a new extention of .udl
make sure you save as all files not txt or some other
file type.
4. the icon for the file should change from notepad to a
little computer - it has now become the wizard.
5. double click on the file and it will bring up a dialog
box with multipule tabs.
6. use the microsoft access provider.
7. look under the ALL tab and there will be parameter settings which you can change if necessary. There is a test
button, press to test the connection.
8. close the file.
9. open the file from notepad instead of double clicking the icon. You will see the connection string which you can copy and paste into your program.
 
I'v get excatly same problem as nickjar2. Did anybody found out the solution? (how to get 'current connection', for which user has already supplied username and password?)
 
asnwer(old,bad version commented out):

Dim CurConn As New ADODB.Connection
Dim p_rst As New ADODB.Recordset
Dim CurDB As Database
Set CurDB = CurrentDb
' Set CurConn = CurrentProject.Connection
' With CurConn
' .Provider = "Microsoft.Jet.OLEDB.4.0"
' .ConnectionString = "data source= " & CurDB.name & ";Persist Security Info=False;"
' .Open
' End With
Set CurConn = CurrentProject.Connection

Set p_rst = New ADODB.Recordset

p_rst.Open "tblPaivystajat", CurConn, adOpenStatic, adLockReadOnly, adCmdTable
 
You might try adding the User ID and Password into the connection string in the following format:
Code:
ConnStr = ConnStr & ";UID=xxxx;PWD=yyyy"


Good Luck
--------------
[i]As a circle of light increases so does the circumference of darkness around it. - Albert Einstein[/i]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top