help with passwords

P

paul

hi ive created a form which opens up with all fields locked. that form has
an unlock button which unlocks all of the fields if the user enters the
correct password. orignally, i had the user entering a password in an
inputbox but realised that this display the password in clear text and not as
*********.

to get round this i was advised to create a form that opens when the unlock
button is pressed (which i did ) then i tried to adapt the code but cant get
it to work, i think it has something to do with the me. statements and a few
others this is the code:

private sub cmdenter_click()

dim stdocname as string
dim stlinkcriteria as string
dim txtseccheck as textbox
dim loki as string

stdocname = "frmupdateunitinformation"

if me.txtseccheck = ucase(NZ(Dlookup("password", "tblpassword ",
"passwordid=1"), ""))
docmd.close
msgbox ("access granted")
docmd.opeformstdocname,,,stlinkcriteria
docmd.maximize
me.allowedits = true
me.allowdeletions = true
me.allow additions = true
else
me.allowedits = false
me.allowdeletions = false
me.allow additions = false
docmd.close

end if

end sub
 
L

Lynn Trapp

You say it's not working but you don't tell us what it IS doing? Do you get
an error message? Does the form open without the AllowEdits (etc.) property
being set to true? Is the "cmdenter" button on the form
"frmupdateunitinformation"? I suspect it isn't and, therefore, a statement
like "me.allowedits" will have no effect on that form. "Me" is a shortcut
for identifying the currently active form, which is, in this case the form
that the command button is on.
 
P

paul

Lynn, thanks for you reply.

the cmdenter button is not on frm updateunitinformation its on the form i
setup to enter the password. i know the me. bit is wrong but i dont know
what to replace me. with?

when i run the code and enter a correct password the password form still
remains on view and i cant get rid of it. when i enter an incorrect password
it works fine.

when i enter a correct password i get an error message that says the object
specified is close...


:
 
L

Lynn Trapp

Try changing your code to this:

private sub cmdenter_click()

dim stdocname as string
dim stlinkcriteria as string
dim txtseccheck as textbox
dim loki as string

stdocname = "frmupdateunitinformation"

if me.txtseccheck = ucase(NZ(Dlookup("password", "tblpassword ",
"passwordid=1"), ""))

msgbox ("access granted")
docmd.opeformstdocname,,,stlinkcriteria
docmd.maximize
forms!frmupdateunitinformation.allowedits = true
forms!frmupdateunitinformation.allowdeletions = true
forms!frmupdateunitinformation.allow additions = true
me.visible = false
else
forms!frmupdateunitinformation.allowedits = false
forms!frmupdateunitinformation.allowdeletions = false
forms!frmupdateunitinformation.allow additions = false
me.visible = false

end if

end sub
 
P

paul

lynn thanks again that worked for that form.

however, is it possilbe to chage this part of the code
forms!frmupdateunitinformation. to something that recognises the form that
called the password form.

the reason that i ask is, i have a number of forms that call the security
form, if i use the forms!frmupdateunitinformation the secuirty form will only
set the read,write value of forms!frmupdateunitinformation.

if it is possilbe i would like to amend:

forms!frmupdateunitinformation.allowedits = true to

form!(the form that called the security form).allowedits = true ect...

hope this makes sense, thanks for your past assistance if you are unable to
help this time

paul
 
A

az

Lynn Trapp said:
Try changing your code to this:

private sub cmdenter_click()

dim stdocname as string
dim stlinkcriteria as string
dim txtseccheck as textbox
dim loki as string

stdocname = "frmupdateunitinformation"

if me.txtseccheck = ucase(NZ(Dlookup("password", "tblpassword ",
"passwordid=1"), ""))

msgbox ("access granted")
docmd.opeformstdocname,,,stlinkcriteria
docmd.maximize
forms!frmupdateunitinformation.allowedits = true
forms!frmupdateunitinformation.allowdeletions = true
forms!frmupdateunitinformation.allow additions = true
me.visible = false
else
forms!frmupdateunitinformation.allowedits = false
forms!frmupdateunitinformation.allowdeletions = false
forms!frmupdateunitinformation.allow additions = false
me.visible = false

end if

end sub

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm




please help me my access cant open at all it ask me administrator pasword
 

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