473,788 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I get a databse password in VBA?

I have a password secured database. After the password is entered the
user has a form that I created that allows them to search the database
and retrieve information.
The problem is that the connection string requires a the database
password even though the user entered it to open the database. How can
I get the password from the system to build the connection string?
Thanks for any help,
Whitey

Nov 13 '05 #1
3 2337
On 9 Jun 2005 10:42:40 -0700, "Whitey" <No********@gma il.com> wrote:

Here is a page with a lot of connectionstrin g info:
http://www.carlprothman.net/Default.aspx?tabid=81

But I have a hard time understanding your quandry. The database is
already open, and to access data you have to provide the password???
Not my experience.
Dim s As String
Dim c As ADODB.Connectio n
s = CurrentProject. BaseConnectionS tring
Set c = CurrentProject. Connection

-Tom.

I have a password secured database. After the password is entered the
user has a form that I created that allows them to search the database
and retrieve information.
The problem is that the connection string requires a the database
password even though the user entered it to open the database. How can
I get the password from the system to build the connection string?
Thanks for any help,
Whitey


Nov 13 '05 #2
Whitey wrote:
The problem is that the connection string requires a the database
password even though the user entered it to open the database. How can
I get the password from the system to build the connection string?


Are you talking about ODBC and a DSN? I get that impression when you
mention connection string. If so, the password for a secured database
for the mdw file that secures the mdb is SEPARATE from the password for
the DSN.

Let me know if you're talking about DSN and those who use ODBC like me
may be able to help you further here.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #3
"Whitey" <No********@gma il.com> wrote in news:1118338960 .535097.95140
@z14g2000cwz.go oglegroups.com:
I have a password secured database. After the password is entered the
user has a form that I created that allows them to search the database
and retrieve information.
The problem is that the connection string requires a the database
password even though the user entered it to open the database. How can
I get the password from the system to build the connection string?
Thanks for any help,
Whitey


You can't... *:(

One thing you can do instead is to secure the database (either create a
new .MDW file via the \Microsoft Office\Office\1 033\WRKGADM.EXE program
or work on a *copy* of SYSTEM.MDW), and create a new user that is the
Owner of the database, say, DBAdmin. Then give the Admin user a password
(even if it's just a carriage return), but take it out of the Admins
group.

Next, make a shortcut that calls Access but uses this new .MDW file,
modified to suit your system, of course:

"c:\program files\microsoft offfice\office\ msaccess.exe" /wrkgrp "c:
\theapp\securit y.mdw" "c:\theapp\myap p.mdb"

Then, be sure to login as DBAdmin, instead of just Admin. It is
important, because you want DBAdmin to be the database owner, and thus,
own all of the database objects (tables, queries, forms, etc). Then,
because by default Access connnects to an MDB file by default as the user
"Admin", you can definitely control access to things this way, and when
you distribute your app to customers, they will log in of course as Admin
(even if they don't get the Access login prompt), which will then open
your custom Login form.

But first, develop a Startup form that is your "login" form. This will be
the form that "logs" users into your application. You don't close this
form, you just hide it, when a user successfully logs in. It should be
owned by DBAdmin, but you give access to the Admin user.

For all your queries, you can give selective access to the data by using
the "WITH OWNERACCESS OPTION", even if you lock down the tables so that
the Admin user can't open them, which is GOOD. You can control data
access (read, insert, update, delete) to the views, then, without
allowing the Admin user any access to the tables themselves.

Let the Admin user access this form, change all your queries to use the
"WITH OWNER ACCESS" option, too.

When you are ready, you will want to write a VBA function that can turn a
bunch of stuff on for you (i.e., disabled menus, disabled F11 key, etc)
if it detects that you log in as DBAdmin. You don't want to go turning
these things off beforehand!

The kind of implied cleverness about this is that you are leveraging
Access' built-in user-level security to do some heinky stuff for you for
not a lot of effort, especially when you distribute your app to other
users, and the data will be LOADS more secure, in practice and in
reality.

You just then have a DBAdmin-owned User table that stores usernames and
hashed passwords (I'm pretty sure that there is VBA code for an MD5 or
SHA-1 hash generator!) in that table.

If you then need to constrain user access in the app to different things,
then if you HIDE your login form, vs closing it, then the user's name
persists, and you then just have to code all your forms (and your UI is
through forms and reports...) to check the MAIN login name, etc.

The goal is to provide an application security layer that you can control
user access to the data without invoking the built-in security layer that
lets you restrict design-level access to the database objects only to you
and your custom Security.mdw file used to build the MDB file that you
distribute and configure to users. Now you don't have to manage MDW files
for users of our app!

There are tools to brute-force the database level password, but I don't
know of any that brute force passwords in a .MDW file (nor have I looked
recently, though).
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1503
by: YM | last post by:
Hi, I have an ACCESS database on the web-server. I build my ASP-driven website around the database. If I need to update dynamic information on the website, I 1) download the entire database 2) edit it 3) upload it back to the server. I don't have a problem with doing that. However, I want everyone in the office to be able to 1) edit the database 2) save it to the server without the FTP download/upload mumbo-jumbo. Oh, and I don't...
3
1478
by: TS | last post by:
Hi all, I posted this question here before, but I'm still having a problem with this code. From my windows form, I opened a connection to a SQL database. I need to generate a combo box in my form from a SELECT statement that selects the last name column from an SQL table. I wrote the following code to do that, but when I run this code it doesn't do anything!! It doesn't even return an error message to let me know what's going on!! All I...
0
1051
by: wajerupali | last post by:
Friends..I have developed MS-Acess-VB project for which database is password protected. I have also made it hidden by writing VB code. But is view-hidden file option is enabled the file will be exposed and would be deleted even if its password protected. Please guide me about either how to prohibit file deletion by writing VB code or suggest an alternate option to secure database rather than just hiding it.
1
1644
by: usraju | last post by:
hai all, Microsoft OLE DB Provider for ODBC Drivers error '80004005' Operation must use an updateable query. /nsc/tracking/signup.asp, line 17 the code is: <%
3
23701
by: Sirisha | last post by:
Hi, I am inserting values into databse using sqlserver stored procedures. i wrote stored preocedure,but in codebehind file(.vb file) i dont know how to pass the parameters, i got error message like this "System.Data.SqlClient.SqlException: Procedure or Function 'sp_insert' expects parameter '@TestId', which was not supplied. at System.Data.SqlClient.SqlConnection" I wrote Stored Procedure Like this:
0
1010
by: sajithkahawatta | last post by:
i want to delete a selected row from the database.the entries of database is shown by a gridview and i do <OnRowDeleting="GridView1_RowDeleting"> in source code. i select and bind as follows. string str = "select PNR,CreditCardNumber as 'Credit Card Number',EmalAddress as 'Email Address',PassengerName as 'Passenger
1
1280
by: Bakarre | last post by:
To display a field from databse and calculate time different -------------------------------------------------------------------------------- Good day, i have problem to display a field from databse and calculate time different. See below my code. I hope somebody can fix the problem for me. <?php
11
4643
by: tokcy | last post by:
Hi everyone, I am new in php and ajax, i am facing the prob while i click on element of first drop down then in second dropdown all element showl come from database. I mean i have three dropdown 1. category which comes from database 2. brand which comes from databse according to content of first dropdown . and 3. price which is static. when i am doing these things without ajax on every onChange() thw whole page is refreshing that i do not...
3
2085
by: zaifi | last post by:
i am working on asp.net project.but i want use asp login control with oracle database.e.g when i login match user id and password with oracle database. .please give me explain..
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10112
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.