Solved

VB6: opening a MDB database with password

Posted on 2006-11-20
7
972 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
  • 3
  • 2
  • 2
7 Comments
 
LVL 9

Expert Comment

by:pradapkumar
Comment Utility
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
Comment Utility
" 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
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 16

Expert Comment

by:JohnBPrice
Comment Utility
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
Comment Utility
.. (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
Comment Utility
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
Comment Utility
>>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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
String manipulation in Visual Basic 7 43
Run code from text file in vb 1 32
VBA filters 2 37
Copy a row 12 52
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now