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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In TransferDatabase method where is the PWD placed

Status
Not open for further replies.

Dalain

Technical User
Jan 10, 2003
104
CA
Hello, I am currently working on a database (Message Creator), which as far as the user is concern; you can Save and Load your work like a word Document. What really happens is that I use the Common Dialog feature so that the used can select a Path and FileName. I then use the PathAndFileName to create a database in the Directory selected by the User. (Using my own default extension)

SAVE File Code

PathAndFileName = “A:\ Enviro_12Jan03.csx”

DoCmd.Hourglass True
Set dbsNew = wrkDefault.CreateDatabase(FileName, dbLangGeneral)

DoCmd.TransferDatabase acExport, "Microsoft Access", PathAndFileName, acTable, "InputEI_Frn", "InputEI_Frn"
(There are 6 Tables transferred like above.)

DoCmd.Hourglass False
DoCmd.Beep
MessageBox = MsgBox("Operation Complete", vbInformation, "Save File")


LOAD File Code
To Load a saved, I first link the Tables to the Database and place an “Lk” in front of the Table Name

(PathAndFileName = “A:\ Enviro_12Jan03.csx”)

DoCmd.TransferDatabase acLink, "Microsoft Access", PathAndFileName , acTable, "InputEI_Frn;", "LkInputEI_Frn"
(There are 6 Tables that get Linked like above.)

If the Link is Successful, I delete the Current information in the Local Tables

DoCmd.RunSQL ("DELETE *FROM InputEI_Frn;")

Then I transfer the Info from the External Table to the Local Table

DoCmd.RunSQL ("INSERT INTO InputEI_Frn SELECT LkInputEI_Frn.* FROM LkInputEI_Frn;")

Then I delete all the Linked Tables

For Each obj In dbs.AllTables
If Mid(obj.Name, 1, 2) = "Lk”
DoCmd.DeleteObject acTable, obj.Name
End If
Next obj


The problem is the data in the Created Database can be sensitive (Personnel Info) and therefore should only be access through the master database (Message Creator) in order to do this I encrypted it and added a password.

In the Save FileCode I entered

Set dbsNew = wrkDefault.CreateDatabase(FileName, dbLangGeneral & ";pwd=1234", dbEncrypt)


This works great, But when I try to Load the File, big Problem!

If I use the Code

DoCmd.TransferDatabase acExport, "Microsoft Access", PathAndFileName, acTable, "InputEI_Frn", "InputEI_Frn"

The user will be asked for the password for each table being transfered and since the Password is hidden in the code, they will never be able to load the file.

So where/how in the statement, do I put the ";pwd=1234;”
 
Try:

PathAndFileName = ";DATABASE= A:\ Enviro_12Jan03.csx;Uid=;pwd=YourPassword"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top