Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB6: opening a MDB database with password

Posted on 2006-11-20
7
Medium Priority
?
987 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
Independent Software Vendors: 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!

 
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 400 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

721 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