?
Solved

Front end program and back end data passwords.

Posted on 2011-02-17
10
Medium Priority
?
436 Views
Last Modified: 2012-06-27
I have a database split between front end file (queries, forms etc) and back end file (data). Up until now I've only passworded the front end for different users without bothering about the data. So I've set a database password for the back end, working on a copy of the data file at the moment. When I open the front end with its user name and password and then try to relink the tables to the copy of the back end it says "not a valid password", but it hasn't actually asked for the password. What is the correct sequence of actions?

Notes: Both files are in Access 2000 format though I always work on them with Access 2007 - under Windows 7. To set the database password for the back end I used Access 2003.
0
Comment
Question by:TonyVile
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34915224
You probably must pass the password and user to back end database from front end one when you make the connection. I mean... the table linking is not going to ask you for user/pass, it will expect them passed as parameters of the connection order.
0
 
LVL 85
ID: 34915520
If I'm not mistaken, the FE and BE passwords must be the same.
0
 

Author Comment

by:TonyVile
ID: 34916831
That's part of the way, thanks. What I'm finding however is that if I link to the BE at the beginning and it's the same password that's OK, but if I do a Relink it's not. Any ideas?
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 10

Accepted Solution

by:
conagraman earned 668 total points
ID: 34927147
good question
 i didnt know how to do that eaither. what i was completly forgetting was the obvious i am making a connection to a database. so the correct connection string is needed.

the back end connection string with a password  is :
                           ";DATABASE=" & "YourPath" & ";PWD=" & "YourPassword" '& ;"



the below code in a button will reconnect with a password. change mypwd = your password.


Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim strConnect As String
Dim dbpath As String
Dim boolresult As String
Dim MyPwd As String
Set objDialog = CreateObject("UserAccounts.CommonDialog")

objDialog.Filter = "Back End|*.accdb"
objDialog.FilterIndex = 1

boolresult = objDialog.ShowOpen

dbpath = objDialog.FileName
MyPwd = "password"
'strConnect = CurrentProject.Path
strConnect = ";DATABASE=" & dbpath & ";PWD=" & MyPwd '& ;"



Set db = CurrentDb
For Each tdf In db.TableDefs

If tdf.Connect <> "" Then

tdf.Connect = strConnect
tdf.RefreshLink
End If
Next tdf

Set tdf = Nothing
Set dbs = Nothing
0
 
LVL 85
ID: 34928759
< if I link to the BE at the beginning and it's the same password that's OK, but if I do a Relink it's not>

How are you relinking? If you're doing so through the Linked Table Manager, then you'll have to reenter the password I believe.
0
 

Author Comment

by:TonyVile
ID: 34930349
That's the thing. It doesn't ask me for a password but produces the error message "not a valid password". Aaargh
0
 
LVL 85
ID: 34930631
Are you using the LTM? If so, you might try deleting and recreating those links as needed. Better still, include code to automate the process, and delete/recreate the links as needed.
0
 
LVL 10

Expert Comment

by:conagraman
ID: 34935627
tonyvile

that is the error when you use that code without the password on a passworded backend. try the code i gave you in a buttons click event should do the trick
0
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 332 total points
ID: 34937090
Just an FYI:

If I'm not mistaken, this code:

CreateObject("UserAccounts.CommonDialog")

won't work on operating systems other than Windows XP. I don't use it, but I've seen it referenced here a few times, and seem to recall others posting odd results with that syntax. Could be a permissions issue, of course, but it seems to have been removed during one of the "security releases" for other versions of Windows.


0
 
LVL 10

Assisted Solution

by:conagraman
conagraman earned 668 total points
ID: 34942675
I was not aware of that thanks for the tip LSM
well i was just using that to locate the back end you can use anyway you want. another dialog or just hardcode it.   the below code is the nitty gritty : )


Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim strConnect As String
Dim dbpath As String
Dim MyPwd As String


dbpath = "c:\yourdatabasePath.accdb"  '--------Your back end path goes here
MyPwd = "password" '--------Your back end password goes here

strConnect = ";DATABASE=" & dbpath & ";PWD=" & MyPwd

Set db = CurrentDb
For Each tdf In db.TableDefs
If tdf.Connect <> "" Then
tdf.Connect = strConnect
tdf.RefreshLink
End If
Next tdf

Set tdf = Nothing
Set dbs = Nothing
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question