Solved

VB6: opening a MDB database with password

Posted on 2006-11-20
7
980 Views
Last Modified: 2013-12-25

  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
Comment
Question by:Fiacre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 9

Expert Comment

by:pradapkumar
ID: 17986516
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
 

Author Comment

by:Fiacre
ID: 18004170
" 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
 
LVL 9

Expert Comment

by:pradapkumar
ID: 18006190
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 16

Expert Comment

by:JohnBPrice
ID: 18101821
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
 

Author Comment

by:Fiacre
ID: 18180808
.. (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
 

Author Comment

by:Fiacre
ID: 18180816
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
 
LVL 16

Accepted Solution

by:
JohnBPrice earned 100 total points
ID: 18181196
>>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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 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