Link to home
Start Free TrialLog in
Avatar of Fiacre
Fiacre

asked on

VB6: opening a MDB database with password


  Set tmpWrk = CreateWorkspace("Admin", "admin", "", dbUseJet)
  Set tmpDb = tmpWrk.OpenDatabase(mGlobal.DBfname_master, False, False, _
  ";pwd=passwordxxx")
  .dTable.DatabaseName = mGlobal.DBfname_master
  .dTable.RecordSource = tmpSQL
  .dTable.Refresh
-----------------------------------------

Hi, the above VB6 codes uses "Admin" as user, to open a database-password (passwordxxx).
It will give a problem, if the user login winXP as a user, instead of administrator, or not sure, maybe a problem if user login as other username instead of Admin (will it ?)

What is the solution then ? Is the solution to replace "Admin" and "admin" both, and with what ?

Avatar of pradapkumar
pradapkumar

this is the problem with access previleges for that file. First of all make sure that whether the windows user having access rights to that file atleast for read access. If not grant appropriate permission for that user and try the same thing again. Definitely it will work.
Avatar of Fiacre

ASKER

" First of all make sure that whether the windows user having access rights to that file atleast for read access."

Hi.

So do you mean i must goto the user's workstation to grant appropriate permission (ie. to have the access rights, for the xxx.mdb) ? And also, i can keep the vb6 codes intact, with "CreateWorkspace("Admin", "admin", "", dbUseJet)  ?

"How to grant appropriate permission" ? goto control panel, user account, and change to administrator ?

Goto the Parent folder's Properties where your xxx.mdb file is stored.
And click on "sharing tab" and share that folder with some simple valid name.
then click on permission button in that same tab.
You can see the permission dialogbox now.
In that You can see "Everyone" User icon with read only permission.
Check the the write and execute permission check boxes and click ok and then ok again.
Now try to execute your program.
It will work now.

Pradap
The user "Admin" is NOT the windows user account, but the database user account stored in the database.  By default there is always an "Admin" database user, such as with SQL Server there is always a "sa" user, and with ORACLE there is always a "SYSTEM_MANAGER" user.  You can create additional users in Access.  

Again these are not the windows accounts (though your windows account does need to have permission to access the .MDB and .LDB files as well as the System.MDB/.LDB files associated with your database.)
Avatar of Fiacre

ASKER

.. (though your windows account does need to have permission to access the .MDB and .LDB files as well as the System.MDB/.LDB files associated with your database.)

there a situation where user can open the MDB database (using my VB6 program with the dbase pwd) but cannot preview the report, but on my computer i can preview ?
Avatar of Fiacre

ASKER

for above qn, if i goto user's computer to open the MDB dbase and close it, then it's solved, but if i just pass the MDB file to the user from my computer, the user cannot preview the report.
ASKER CERTIFIED SOLUTION
Avatar of JohnBPrice
JohnBPrice

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial