Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 994
  • Last Modified:

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 ?

0
Fiacre
Asked:
Fiacre
  • 3
  • 2
  • 2
1 Solution
 
pradapkumarCommented:
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.
0
 
FiacreAuthor Commented:
" 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 ?

0
 
pradapkumarCommented:
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
JohnBPriceCommented:
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.)
0
 
FiacreAuthor Commented:
.. (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 ?
0
 
FiacreAuthor Commented:
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.
0
 
JohnBPriceCommented:
>>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 ?

Absolutely, if you have security turned on and you are using a different database user than they are.

>>if i goto user's computer to open the MDB dbase and close it, then it's solved
I don't understand, if you simply open and then close the database, then they can see the report?

There are TWO layers of security here, one is the Windows file security, which sounds like is not your problem.  If they can open the MDB file, thye have successfully passed Windows file security.

The second layer is entirely within Access.  You can create users, assign privleges to different objects, etc.  In the MDB, go to Tools>>Security>> User and Group Permissions.  In the window, change the Object Type to reports and you can see what privleges each user or group has on each report.  By default, Access databases have one user named "Admin", and two groups, "Admins" (note the plural), and "Users".

You can add additional users or groups to control security.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now