rjAccDB
Feb 13 2007, 10:57 AM
Hello UA,
I have a form being locked by the below code;
-
Form_frmCorrFilter.AllowEdits = False
Form_frmCorrFilter.AllowAdditions = False
Form_frmCorrFilter.AllowFilters = False
Form_frmCorrFilter.AllowDeletions = False
-
How can I make all these into "TRUE" on a button click, but I need to protect it by a password.
Many thanks for the help.
rj
Kauchais
Feb 13 2007, 11:03 AM
Are you going to use windows login password or one just for this?
freakazeud
Feb 13 2007, 11:05 AM
Hi,
one possible solution would be utilizing the InputBox() function on the on click event of the button e.g.:
Dim strInput As String
Dim strMsg As String
strMsg = "Enter Password!"
strInput = InputBox(Prompt:=strMsg, title:="Enter Password:")
If strInput = "YourPassWord" Then
'set properties to true
Else
MsgBox("Wrong Password...sorry!")
End If
This is obviously not very secure...but it all depends on what you need.
HTH
Good luck
rjAccDB
Feb 13 2007, 11:09 AM
Hi,
That was very quick.
Ok, my form is opened it is locked, before the user can make enable for edit, it need to click a button, but before it completely enabling the form it needs to enter the set password.
Hope that make sense.
rj
rjAccDB
Feb 13 2007, 11:12 AM
Hi Oli,
You have a sharp mind!..
I will try it.
Thanks,
rj
freakazeud
Feb 13 2007, 11:13 AM
You're welcome.
Good luck.
Kauchais
Feb 13 2007, 11:14 AM
two options have freakazeud code run when they open the form or when they click a button on the form.
if a button on the form in the event proc. on click for the button have
Dim strInput As String
Dim strMsg As String
strMsg = "Enter Password!"
strInput = InputBox(Prompt:=strMsg, title:="Enter Password:")
If strInput = "YourPassWord" Then
Form_frmCorrFilter.AllowEdits = true
Form_frmCorrFilter.AllowAdditions = true
Form_frmCorrFilter.AllowFilters = true
Form_frmCorrFilter.AllowDeletions = true
Else
MsgBox("Wrong Password...sorry!")
End If
or you could save the password on a table of users and ask for user then password.
rjAccDB
Feb 13 2007, 11:18 AM
Hello Oli,
That works for the purpose, many many thanks,
rj
freakazeud
Feb 13 2007, 11:19 AM
You're welcome.

Glad I could assist.
Good luck on future projects!
rjAccDB
Feb 13 2007, 11:20 AM
Hi Oli,
Now how can I customise the dialog box title, instead of displaying "Microsoft Office Access" I want to display the name of my DB..
Sorry for asking to much,
rj
freakazeud
Feb 13 2007, 11:25 AM
Hi,
check the syntax of the InputBox() function. The whole syntax is:
InputBox(prompt [, title ] [, default ] [, xpos ] [, ypos ] [, helpfile ] [, context ] )
Another approach would be to use a custom form which you format to look like you want and open up to enter the password in a control on the form. This would give you some more flexibility.
You might also find this
sample helpful.
HTH
Good luck
rjAccDB
Feb 13 2007, 11:26 AM
Hello Kauchais,
Thank you, you both a genius - the last line "or you could save the password on a table of users and ask for user then password" is a bit advance to my level.
Thanks,
rj
rjAccDB
Feb 13 2007, 11:28 AM
Many thanks Oli...
freakazeud
Feb 13 2007, 11:30 AM
No problemo...
rjAccDB
Feb 14 2007, 04:36 AM
Hi Oli,
Am trying to play around with the customization of MsgBox thing but not able to do it.
I have examined your demo db's, copy some MsgBox format and try to change some entries but I always got the Microsoft Visual Basic Error Dialog saying (Compile error: Expected:=). Am totaly lost.
Just want to put customized title, instead of Microsoft Office Access.
Maybe Im just too dumb to follow syntax....
freakazeud
Feb 14 2007, 11:33 AM
Can you post what you have been trying to use?
HTH
Good luck
rjAccDB
Feb 15 2007, 12:39 AM
Hi Oli,
Thanks for your time, I think I sorted out by removing the "( )" as below;
--
from... MsgBox ( "Wrong Password...", vbInformation, "User Validation")
to... MsgBox "Wrong Password...", vbInformation, "User Validation"
--
I don't if this is the correct way, but it did what I wanted..
Oli, thank you very much once again.
rj
Edited by: ksalearnsaccess on Thu Feb 15 0:43:03 EST 2007.
freakazeud
Feb 15 2007, 08:56 AM
Yes...that is the correct way.
Glad you got it sorted out.
Good luck on future projects!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.