473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2320
On 9 Jun 2005 10:42:40 -0700, "Whitey" <No********@gmail.com> wrote:

Here is a page with a lot of connectionstring 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.Connection
s = CurrentProject.BaseConnectionString
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********@gmail.com> wrote in news:1118338960.535097.95140
@z14g2000cwz.googlegroups.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\1033\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\security.mdw" "c:\theapp\myapp.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
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)...
3
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...
0
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...
1
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
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...
0
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....
1
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...
11
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....
3
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.