Can a form have a section that is password protected

pdavis27040

Registered User.
Local time
Today, 18:18
Joined
Apr 10, 2003
Messages
18
Hey everyone!!

Here is the situation.

I have a database that when open it gives a choice enter form database, query or exit. I click on exit and the form for the main database comes up. Half of the form I would like to whoever input the information but the bottom have of the form I would like an admin to input the information. The bottom half of the form consist of the following:

4 check boxes and 2 text boxes. Any suggestions on how I should set this up for the bottom part to be password protected?
My thinking was to remove them from the form and insert a the text box for the password and a button. Once confirmed that this works the bottom part of the form appears or opens in a new form. Any help ideas or the how to do something like this would be GREAT. The file size of the db file zipped is over 200k so if you would like for me to email you please let me know!! I appreciate all the help from this great forum!!
 
I suggest that you move the part you want hidden to the footer section of the form.
You can add a password step to a command button to unhide the forms footer.
The user will type a password into an input box, if correct...the footer is made visible.

Here is some code to call the input box and ask for the password.

Dim strInput As String
Dim strMsg As String

Beep
strMsg = "These functions are used only by the Special People." & vbCrLf & vbLf & "Please key the Special People password to display the hidden stuff."
strInput = InputBox(Prompt:=strMsg, title:="Special People Password")
If strInput = "YourPasswordHere" Then 'password is correct
Beep
Me.FormFooter.Visible = False 'unhide form footer
Else 'password is incorrect
Beep
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access to the hidden stuff.", vbCritical, "Invalid Password"
Exit Sub
End If

You can not format an input box!

HTH
 
ghudson said:
Beep
strMsg = "These functions are used only by the Special People." & vbCrLf & vbLf & "Please key the Special People password to display the hidden stuff."
strInput = InputBox(Prompt:=strMsg, title:="Special People Password")
If strInput = "YourPasswordHere" Then 'password is correct
Beep
Me.FormFooter.Visible = False 'unhide form footer
Else 'password is incorrect
Beep
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access to the hidden stuff.", vbCritical, "Invalid Password"
Exit Sub
End If

Just one change - the line in bold should read:

Code:
Me.FormFooter.Visible = True
 
Refresh

Hey that worked great!!! 2 questions though.

Is there a way when you go in and put in your password that when you go to the next record to make an update that it refreshes and is locked again till the password is put in?

My second question is there a way that when you put in the password that it shows up ***** instead of showing the actual passcode?

Thanks Again Everyone!! Hope I can return the favor sometime!!
 
On thetextbox you can set its Input Mask property to Password.

I suppose on the OnCurrent() event you could do something like this, which will hide it again.

Me.FormFooter.Visible = False
 
Hmmmm..

I guess this is where I get confused at.

This txt box is unbound I suppose since its in a script and to set the input mask you would have to have it bound to a table correct? Or within the script can you set the input mask to password?

On_Control() is another section I am having a problem at. Where is this option usually set?
 
Re: Hmmmm..

pdavis27040 said:
I guess this is where I get confused at.

This txt box is unbound I suppose since its in a script and to set the input mask you would have to have it bound to a table correct? Or within the script can you set the input mask to password?

The textbox has an Input Mask property, just write Password into this.



On_Control() is another section I am having a problem at. Where is this option usually set?

I'm not surprised this is causing you problems - I said OnCurrent().

It's a form event.
 
Ooops

My bad, I meant to put OnCurrent() just had control on the mind. I will try it out. The problem is with this script that is listed above it doesnt give you or I havent found yet when it comes to the text box that pops up after the button is clicked the input mask feature. I will play w/ it however and see what I can come up with.
 
Sorry, my fault - I thought the password was being entered into a textbox but I see now that it is an input box that is being used.

You could, instead of the input box, put a command button and textbox on your form (maybe in a corner) and then you can get a passsword input mask.
 
So I guess

So I guess than the script from above will not do the trick? Or can it be edited to work w/ the textbox?
 
If you put the textbox and command button on your form you will only need to change one line of the code given:

Code:
strInput = InputBox(Prompt:=strMsg, title:="Special People Password")

to:

Code:
strInput = Me.txtYourTextbox
 
Awesome

Hey that worked. Gonna have to do some research on this OnCurrent() item. Still not able to get that to work and I looked in the event section of the text box but there is no oncurrent there. I appreciate all the help though!!! I am MUCH closer to finishing than I was earlier!!
 
Textboxes don't have an OnCurrent() event; as I've said before it's a form event.
 
Here are my scripts.. can anyone help with this refresh problem?

Here is a copy of my scripts... any help with the refresh on the password protective part would be great. Read above for more info.

Thanks!!

Private Sub Check155_AfterUpdate()
If Me.Check155.Value = -1 Then
Me.VIP.Caption = "VIP"
Me.VIP.Visible = True
Else
Me.VIP.Caption = ""
Me.VIP.Visible = False
End If

End Sub

Private Sub Command262_Click()
Beep
strMsg = "These functions are used only by the Special People." & vbCrLf & vbLf & "Please key the Special People password to display the hidden stuff."
strInput = Me.Text263
If strInput = "YourPasswordHere" Then 'password is correct
Beep
Me.FormFooter.Visible = True 'unhide form footer
Else 'password is incorrect
Beep
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access to the hidden stuff.", vbCritical, "Invalid Password"
Exit Sub
End If
End Sub

Private Sub Exit_Click()
On Error GoTo Err_Exit_Click


DoCmd.Close

Exit_Exit_Click:
Exit Sub

Err_Exit_Click:
MsgBox Err.Description
Resume Exit_Exit_Click

End Sub

Private Sub Text131_Click()
Dim b As Byte

b = Forms("multi").Controls("Event Entry").MultiSelect


Forms("multi").Controls("Event Entry").MultiSelect = 2 ' Extended.
End Sub

Private Sub Form_AfterInsert()
If Me.Check155.Value = False Then
Me.VIP.Caption = ""
Me.VIP.Visible = False
Else
Me.VIP.Caption = "VIP"
Me.VIP.Visible = True
End If
End Sub

Private Sub Form_Current()
If Me.Check155.Value = False Then
Me.VIP.Caption = ""
Me.VIP.Visible = False
Else
Me.VIP.Caption = "VIP"
Me.VIP.Visible = True
End If
End Sub

Private Sub membershipdate_AfterUpdate()
Me.ExpirationDate = Me.membershipdate + 366
End Sub

On the Command 262 this is where my password protective command button and text box is Text263 located. My problem is when I am finished putting in my record and go to the next I need it to refresh. Any suggestions on the how to on this? I do appreciate it!!!
 
Are you asking how to clear the text box of the password keyed?

Of so, use this at the end of your routine to clear the text box for you should clear the text box if the password keyed was right or wrong.

Text263 = ""

HTH
 
Have a look at this - see if it helps.

The password, in this case, is simply Password.
 

Attachments

Last edited:
educate the incompetent

Quick question for you in the code you have the following

Quote
strMsg = "These functions are used only by the Special People." & vbCrLf & vbLf & "Please key the Special People password to display the hidden stuff."
unquote

please can you educate me as to what the '& vbCrLf & vbLf' are there for as i cant see what they do and would like to know

ta
ND
 
please can you educate me as to what the '& vbCrLf & vbLf' are there for as i cant see what they do and would like to know
Check the help files for Miscellaneous Constants

FYI: When in doubt with code, select the keywork and press the F1 key to see if Access recognizes it. Try it with the vbCrLf

HTH
 
thanks

thanks for the tip

funny enough i came across it in a book i am reading about 30 min after i posted

a carriage return very nice

ta
ND
 

Users who are viewing this thread

Back
Top Bottom