form and passwords

P

paul

I would be grateful if anyone could help me follow up this old post...

old post reads:

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

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



Expand AllCollapse All
 
L

Lynn Trapp

You could create a public function something like the following:

Public V_SecuritySet As Boolean

Public Function SetSecurity() As Boolean
DoCmd.OpenForm "frmSetSecurity"
If Forms!frmsetsecurity.txtPassword = "password" Then
V_SecuritySet = True
Else
V_SecuritySet = False
End If
If V_SecuritySet Then
SetSecurity = True
Else
SetSecurity = False
End If

End Function

Then call that function from your calling form this way:

Private Sub cmdSecurity_Click()
If SetSecurity() Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If
End Sub
 

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

Top