Passwords in the code.

P

paul

hi ive password protected individual form in my database;
i know its not the most efficient way of doing it but...

what i would like to be able to do is put in the code
somesort of look up thing so i can build a form that
allows easy amendment of the password rather than having
it as part of the code...

the code reads as follows at the moment

dim isgm as string

isgm = msgbox ("enter Password")
if Ucase isgm = "hotelpassword" then
do.cmd openform "frmHotel"
elseif isgm <> "hotelpassword" then
msgbox "incorrect password"

end if

in line 2 of the code, if Ucase isgm = "hotelpasswork"
then can i put in the "" a command that will tell the code
to look for a value in a table or something such like"
 
R

Ron Weiner

Paul

I am not sure I understand what you want to do, but I am guessing that you
want to store the password in a table instead of hardcoding in your VBA
Code. If this is what you are interested in you probable would do well to
look at DLookUp() and NZ() functions.

If you had a table called tblPassword and it had 2 fields PasswordID (an
Autonumber field) and Password (A Text field) then it might look like:

If Ucase(isgm) = Ucase(NZ(Dlookup("Password","tblPassword ","PasswordID
=1"),"")) then
'Let em in
Else
' Dont Let em in
End IF

When there are only two possible outcomes for your IF decision you need not
use the Else IF, Else by itself is sufficient.

Ron W
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top