Password Protect A Form

mark curtis

Registered User.
Local time
Today, 22:29
Joined
Oct 9, 2000
Messages
457
Dear All,

Is there any way that I prompt a user to define a password the first time they create a new record(Work Package), save the password to a table with the record ID and then every time after when they try to load the record via a command button they are prompted for the password to load the record in form view.

Any similar functionality or code would be appreciated as I am not the greatest "coder" in the world.

Thanks
Mark
 
Hi Mark,

Me Again!!!

The way I password protect docs is to set a form level string variable.

Dim strPWORD As String
strPWORD = InputBox("Welcome to the Program" & vbCrLf & _
"Please enter password:", "PASSWORD REQUIRED")
If strPWORD <> "Refit" Then
DisplayMessage "Sorry, you have entered the incorrect password" & vbCrLf & _
" This program will not open on this occasion"
DoCmd.Quit
End If

The above will work fine if you are after having a fixed password. If it needs to be variable you will have to give the user the ability to change it also.

Is that any good for you?

Ian
 
For various security issues I use the Windows registry. It is easy to hide entries (even encrypted) in it and it is very fast.
 
Thanks for the replies. To follow on how do I give the user the ability to change the password for their individual records.

Thanks
Mark
 
The way to do this is to build a table called say PWords with two fields(TheUser,ThePassword).

Use a similar function as stated earlier but instead of using a form level string variable reference the value in the table using a DLOOKUP function.

Personally, I have a form which pops up at the beginnning of my application asking for users to register and prevents access if the trial has ended. This is my code:

If Me.RegistrationCode = Me.SystemUnlockCode Then
'Code correct, save and close the form, point focus at switchboard
DoCmd.Save
MsgBox "Your product has been registered"
DoCmd.Close
Forms("Switchboard").SetFocus
DoCmd.Maximize
Else
'Trial running, code incorrect
If Me.TrialEnd >= Date Then
'Ask if wish to register?
Resp = MsgBox("Registration Code Incorrect, you have " & Me.TrialEnd - Date & _
" days left." & Chr(13) & "Do you wish to try again?", vbYesNo, "AI Solutions")
'Yes pressed, return focus to reg code
If Resp = vbYes Then
Me.RegistrationCode = "Type Code Here"
Me.RegistrationCode.SetFocus
Else
'No pressed, message and close form, set focus to switchboard
MsgBox "Please register within the next " & Me.TrialEnd - Date & _
" days"
DoCmd.Close
Forms("Switchboard").SetFocus
DoCmd.Maximize
End If

Else
'Trial period has finished
'Ask if wish to register?
Resp2 = MsgBox("Registration Code Incorrect, the trial has ended" & Chr(13) & _
"Do you wish to try to register again?", vbYesNo, "AI Solutions")
If Resp2 = vbNo Then
'Not wanting to register
MsgBox "Please register at a later date"
DoCmd.Quit
Else
'Reset focus to form for registering
Me.RegistrationCode = "Type Code Here"
Me.RegistrationCode.SetFocus
End If
End If
End If

I hope that helps you, sorry I can't write it for you, but that wouldn't be fair would it, not sharing the nightmare?

Ian
 
Thanks Ian,

I will have a crack at it and you are right: How can I learn if I don't have a go.

TY
Mark
 

Users who are viewing this thread

Back
Top Bottom