If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
InputBox Mask ****** & Call it 3 times.
Hi;
Have created frmPasswordEnter. This frmPasswordEnter opens the first time a User enters the DBase. It is triggered by an If/Then function in the "AutoExec" macro. Public Function PasswordPrompt() Dim strInput As String, strMsg As String strMsg = "Enter your Password." strInput = InputBox(Prompt:=strMsg, If(isnull((DLookup("[Password]", "tblMainTbl") then DoCmd.OpenForm "frmPasswordEnter" Else If strInput Like (DLookup("[Password]", "tblMainTbl")) Then DoCmd.OpenForm "frmMainData" Else MsgBox "That is not the correct password. Please enter the correct password." End If This all works fine up to a point. First need to "Mask" the Input password. E.G.: Instead of "MyPassword" it should show ********** Second how do You get the Inputbox to prompt 3 times. E.G.: InputBox WrongPassword then InputBox WrongPassword then InputBox WrongPassword then MSGBOX "Dbase is Closing" Have read Microsoft's Supports including "209871 How to Create a Password Protected Form or Report" but that requires a separate form with it's own module and the code is long and cumbersome. Believe the approach described above is a lot simpler and it doesn't take up as much "Real Estate" as Microsoft's solution. Would someone be so kind as to point me in the correct direction? Thank You for reading this post. Andy |
#2
|
|||
|
|||
InputBox Mask ****** & Call it 3 times.
This is what I did, I use it for both the opening and some forms that I want
administrative rights for the user to continue. I made a form that is bound to a user table(name of users and passwords, in the table I set the passwords property to password. Then I added a combobox(combo21, users name from field), textbox(vat2 for the password(unbound)), textbox(vat1,from the password field), textbox(counter, to count the number of retries(unbound)) then use the following code. Use the password option for your textboxes that use a password. Make invisible - vat1 Dim strMsg As String If IsNull(Me.Combo21) Then MsgBox "Please Select a Name First", vbExclamation + vbOKOnly, "No Name Selected" Me.Combo21.SetFocus Me.vat2 = "" End If If Me.vat2 = Me.vat1 Then DoCmd.Close 'Do what ever End If If Me.vat2 Me.vat1 Then If IsNull(Me.counter) Or Me.counter = "" Then MsgBox "Your Password does not match!", vbExclamation + vbOKOnly, "PLEASE TRY AGAIN!" Me.counter = "1" Me.vat2 = "" Me.Combo21.SetFocus Me.vat2.SetFocus Exit Sub End If End If If Me.counter = "1" Then MsgBox "Your Password does not match!", vbExclamation + vbOKOnly, "PLEASE TRY AGAIN!" Me.counter = "2" Me.vat2 = "" Me.Combo21.SetFocus Me.vat2.SetFocus Exit Sub End If If Me.counter = "2" Then MsgBox "Your Passwords have not matched the past 2 times, Please contact the administrator for futher assistance.", vbExclamation + vbOKOnly, "Invalid Password!" Me.counter = "" DoCmd.Quit End If End Sub Hope this helps David |
#3
|
|||
|
|||
InputBox Mask ****** & Call it 3 times.
"Andy" wrote in
: First need to "Mask" the Input password. E.G.: Instead of "MyPassword" it should show ********** Cannot with an input box: you'll need to create an unbound form with a single textbox (txtInput) and a single command button (cmdOK) Set the textbox InputMask to "password". You can do the looking up in the code behind the form; then if it's correct you hide the form (me.visible = false) and if it's wrong then you unload it. Second how do You get the Inputbox to prompt 3 times. E.G.: InputBox WrongPassword then InputBox WrongPassword then InputBox WrongPassword then MSGBOX "Dbase is Closing" set a counter: increment it every time the user clicks the OK button. Don't unload the form unless the guess is wrong and the counter reaches three. The calling code can (1) see if the form is still loaded and invisible, read the password text and then unload it; or (2) if it's unloaded then there was no successful attempt. Have read Microsoft's Supports including "209871 How to Create a Password Protected Form or Report" but that requires a separate form with it's own module and the code is long and cumbersome. Not really: a dozen lines or so of code. Believe the approach described above is a lot simpler and it doesn't take up as much "Real Estate" as Microsoft's solution. Only little bit simpler: the complexity is all this database looking up stuff you are doing (which is not particularly safe anyway). It might be a better idea to store the password in the database Properties, where they can't be seen except using VBA code, rather than in a table which can be read by anyone. At least you might want to encrypt it? In any case, there is no way of passwording an InputBox. Hope that helps Tim F |
#4
|
|||
|
|||
InputBox Mask ****** & Call it 3 times.
There is no formatting for an input box. You will need to use your password
input form instead. Instead of using an Autoexec macro, make your password form the form to show on open. (Tools-Startup, Display Form/Page. To mask the password input, use the input mask property of the text box. Set it to Password. It is a named format that will take care of that for you. Then put your code in After Update event of the password text box: Private Sub txtPassword_AfterUpdate() Dim lngRetries as Long Dim varGoodWord as Variant varGoodWord = (DLookup("[Password]", "tblMainTbl")) If Isnull(varGoodWord) Then DoCmd.OpenForm "frmMainData" Else Do While lngRetries 3 If Me.txtPassword = varGoodWord then DoCmd.OpenForm "frmMainData" Exit Do Else MsgBox "That is not the correct password. " _ & "Please enter the correct password." lngRetries = lngRetries + 1 Me.txtPassword.SetFocus End If End Do If lngRetries = 3 Then DoCmd.Quit End If End If DoCmd.Close End Sub "Andy" wrote: Hi; Have created frmPasswordEnter. This frmPasswordEnter opens the first time a User enters the DBase. It is triggered by an If/Then function in the "AutoExec" macro. Public Function PasswordPrompt() Dim strInput As String, strMsg As String strMsg = "Enter your Password." strInput = InputBox(Prompt:=strMsg, If(isnull((DLookup("[Password]", "tblMainTbl") then DoCmd.OpenForm "frmPasswordEnter" Else If strInput Like (DLookup("[Password]", "tblMainTbl")) Then DoCmd.OpenForm "frmMainData" Else MsgBox "That is not the correct password. Please enter the correct password." End If This all works fine up to a point. First need to "Mask" the Input password. E.G.: Instead of "MyPassword" it should show ********** Second how do You get the Inputbox to prompt 3 times. E.G.: InputBox WrongPassword then InputBox WrongPassword then InputBox WrongPassword then MSGBOX "Dbase is Closing" Have read Microsoft's Supports including "209871 How to Create a Password Protected Form or Report" but that requires a separate form with it's own module and the code is long and cumbersome. Believe the approach described above is a lot simpler and it doesn't take up as much "Real Estate" as Microsoft's solution. Would someone be so kind as to point me in the correct direction? Thank You for reading this post. Andy |
#5
|
|||
|
|||
InputBox Mask ****** & Call it 3 times.
Gentlemen;
Thank You for the replies. All of Your answers are more streamlined then that offered by Microsoft. You have put a smile on this face ;-) Andy "Andy" wrote in message ... Hi; Have created frmPasswordEnter. This frmPasswordEnter opens the first time a User enters the DBase. It is triggered by an If/Then function in the "AutoExec" macro. Public Function PasswordPrompt() Dim strInput As String, strMsg As String strMsg = "Enter your Password." strInput = InputBox(Prompt:=strMsg, If(isnull((DLookup("[Password]", "tblMainTbl") then DoCmd.OpenForm "frmPasswordEnter" Else If strInput Like (DLookup("[Password]", "tblMainTbl")) Then DoCmd.OpenForm "frmMainData" Else MsgBox "That is not the correct password. Please enter the correct password." End If This all works fine up to a point. First need to "Mask" the Input password. E.G.: Instead of "MyPassword" it should show ********** Second how do You get the Inputbox to prompt 3 times. E.G.: InputBox WrongPassword then InputBox WrongPassword then InputBox WrongPassword then MSGBOX "Dbase is Closing" Have read Microsoft's Supports including "209871 How to Create a Password Protected Form or Report" but that requires a separate form with it's own module and the code is long and cumbersome. Believe the approach described above is a lot simpler and it doesn't take up as much "Real Estate" as Microsoft's solution. Would someone be so kind as to point me in the correct direction? Thank You for reading this post. Andy |
#6
|
|||
|
|||
InputBox Mask ****** & Call it 3 times.
Just to check Andy... you know that any of these methods (and that also
includes the MS one) can be overridden by just holding down the Shift key? If you want any level of real security you need to use user level security. "Andy" wrote in message ... Gentlemen; Thank You for the replies. All of Your answers are more streamlined then that offered by Microsoft. You have put a smile on this face ;-) Andy "Andy" wrote in message ... Hi; Have created frmPasswordEnter. This frmPasswordEnter opens the first time a User enters the DBase. It is triggered by an If/Then function in the "AutoExec" macro. Public Function PasswordPrompt() Dim strInput As String, strMsg As String strMsg = "Enter your Password." strInput = InputBox(Prompt:=strMsg, If(isnull((DLookup("[Password]", "tblMainTbl") then DoCmd.OpenForm "frmPasswordEnter" Else If strInput Like (DLookup("[Password]", "tblMainTbl")) Then DoCmd.OpenForm "frmMainData" Else MsgBox "That is not the correct password. Please enter the correct password." End If This all works fine up to a point. First need to "Mask" the Input password. E.G.: Instead of "MyPassword" it should show ********** Second how do You get the Inputbox to prompt 3 times. E.G.: InputBox WrongPassword then InputBox WrongPassword then InputBox WrongPassword then MSGBOX "Dbase is Closing" Have read Microsoft's Supports including "209871 How to Create a Password Protected Form or Report" but that requires a separate form with it's own module and the code is long and cumbersome. Believe the approach described above is a lot simpler and it doesn't take up as much "Real Estate" as Microsoft's solution. Would someone be so kind as to point me in the correct direction? Thank You for reading this post. Andy |
#7
|
|||
|
|||
InputBox Mask ****** & Call it 3 times.
Rob;
Yes I do know that; so I followed this from Access Help. Is it sufficient?: If you clear the Use Access Special Keys check box and you specify a custom menu bar in the Menu Bar box, the built-in menu bar isn't accessible. If you clear both the Use Access Special Keys check box and the Display Database Window check box, it's possible that users can still access the Database window. This can happen when a user tries more than once to open the same Access database or Access project from the list of most-recently-used Access databases or Access projects, which automatically appears on the File menu. To prevent users from accessing this list, replace the File menu with your own custom menu. Andy "Andy" wrote in message ... Hi; Have created frmPasswordEnter. This frmPasswordEnter opens the first time a User enters the DBase. It is triggered by an If/Then function in the "AutoExec" macro. Public Function PasswordPrompt() Dim strInput As String, strMsg As String strMsg = "Enter your Password." strInput = InputBox(Prompt:=strMsg, If(isnull((DLookup("[Password]", "tblMainTbl") then DoCmd.OpenForm "frmPasswordEnter" Else If strInput Like (DLookup("[Password]", "tblMainTbl")) Then DoCmd.OpenForm "frmMainData" Else MsgBox "That is not the correct password. Please enter the correct password." End If This all works fine up to a point. First need to "Mask" the Input password. E.G.: Instead of "MyPassword" it should show ********** Second how do You get the Inputbox to prompt 3 times. E.G.: InputBox WrongPassword then InputBox WrongPassword then InputBox WrongPassword then MSGBOX "Dbase is Closing" Have read Microsoft's Supports including "209871 How to Create a Password Protected Form or Report" but that requires a separate form with it's own module and the code is long and cumbersome. Believe the approach described above is a lot simpler and it doesn't take up as much "Real Estate" as Microsoft's solution. Would someone be so kind as to point me in the correct direction? Thank You for reading this post. Andy |
#8
|
|||
|
|||
Still Don't Understand: InputBox Mask ****** & Call it 3 times.
Hi;
Have spent the last few hours trying to get Klatuu's code running correctly. I know I have a lot to more to learn. The code just doesn't work correctly. The frm is closed after the first try and VBA is showing "End Do" in red. Using A2K so changed it to Exit Do and that still doesn't work. Woul You be so kind to offer a little more help? Andy "Andy" wrote in message ... Hi; Have created frmPasswordEnter. This frmPasswordEnter opens the first time a User enters the DBase. It is triggered by an If/Then function in the "AutoExec" macro. Public Function PasswordPrompt() Dim strInput As String, strMsg As String strMsg = "Enter your Password." strInput = InputBox(Prompt:=strMsg, If(isnull((DLookup("[Password]", "tblMainTbl") then DoCmd.OpenForm "frmPasswordEnter" Else If strInput Like (DLookup("[Password]", "tblMainTbl")) Then DoCmd.OpenForm "frmMainData" Else MsgBox "That is not the correct password. Please enter the correct password." End If This all works fine up to a point. First need to "Mask" the Input password. E.G.: Instead of "MyPassword" it should show ********** Second how do You get the Inputbox to prompt 3 times. E.G.: InputBox WrongPassword then InputBox WrongPassword then InputBox WrongPassword then MSGBOX "Dbase is Closing" Have read Microsoft's Supports including "209871 How to Create a Password Protected Form or Report" but that requires a separate form with it's own module and the code is long and cumbersome. Believe the approach described above is a lot simpler and it doesn't take up as much "Real Estate" as Microsoft's solution. Would someone be so kind as to point me in the correct direction? Thank You for reading this post. Andy |
#9
|
|||
|
|||
InputBox Mask ****** & Call it 3 times.
Nope. It isn't. Go into Access directly (i.e. without double clicking an
mdb or using a shortcut to an mdb), File, Open, hold down the Shift key while you hit OK and you bypass anything like that. "Andy" wrote in message ... Rob; Yes I do know that; so I followed this from Access Help. Is it sufficient?: If you clear the Use Access Special Keys check box and you specify a custom menu bar in the Menu Bar box, the built-in menu bar isn't accessible. If you clear both the Use Access Special Keys check box and the Display Database Window check box, it's possible that users can still access the Database window. This can happen when a user tries more than once to open the same Access database or Access project from the list of most-recently-used Access databases or Access projects, which automatically appears on the File menu. To prevent users from accessing this list, replace the File menu with your own custom menu. Andy "Andy" wrote in message ... Hi; Have created frmPasswordEnter. This frmPasswordEnter opens the first time a User enters the DBase. It is triggered by an If/Then function in the "AutoExec" macro. Public Function PasswordPrompt() Dim strInput As String, strMsg As String strMsg = "Enter your Password." strInput = InputBox(Prompt:=strMsg, If(isnull((DLookup("[Password]", "tblMainTbl") then DoCmd.OpenForm "frmPasswordEnter" Else If strInput Like (DLookup("[Password]", "tblMainTbl")) Then DoCmd.OpenForm "frmMainData" Else MsgBox "That is not the correct password. Please enter the correct password." End If This all works fine up to a point. First need to "Mask" the Input password. E.G.: Instead of "MyPassword" it should show ********** Second how do You get the Inputbox to prompt 3 times. E.G.: InputBox WrongPassword then InputBox WrongPassword then InputBox WrongPassword then MSGBOX "Dbase is Closing" Have read Microsoft's Supports including "209871 How to Create a Password Protected Form or Report" but that requires a separate form with it's own module and the code is long and cumbersome. Believe the approach described above is a lot simpler and it doesn't take up as much "Real Estate" as Microsoft's solution. Would someone be so kind as to point me in the correct direction? Thank You for reading this post. Andy |
#10
|
|||
|
|||
InputBox Mask ****** & Call it 3 times.
Hey Rob;
You got me thinking and smiling. Beliving that since You have learned this; You have also learned how to overcome it. Would You be so kind to point me in the correct direction so that I may overcome this "Obstacle" also? Andy "Rob Oldfield" wrote in message ... Nope. It isn't. Go into Access directly (i.e. without double clicking an mdb or using a shortcut to an mdb), File, Open, hold down the Shift key while you hit OK and you bypass anything like that. "Andy" wrote in message ... Rob; Yes I do know that; so I followed this from Access Help. Is it sufficient?: If you clear the Use Access Special Keys check box and you specify a custom menu bar in the Menu Bar box, the built-in menu bar isn't accessible. If you clear both the Use Access Special Keys check box and the Display Database Window check box, it's possible that users can still access the Database window. This can happen when a user tries more than once to open the same Access database or Access project from the list of most-recently-used Access databases or Access projects, which automatically appears on the File menu. To prevent users from accessing this list, replace the File menu with your own custom menu. Andy "Andy" wrote in message ... Hi; Have created frmPasswordEnter. This frmPasswordEnter opens the first time a User enters the DBase. It is triggered by an If/Then function in the "AutoExec" macro. Public Function PasswordPrompt() Dim strInput As String, strMsg As String strMsg = "Enter your Password." strInput = InputBox(Prompt:=strMsg, If(isnull((DLookup("[Password]", "tblMainTbl") then DoCmd.OpenForm "frmPasswordEnter" Else If strInput Like (DLookup("[Password]", "tblMainTbl")) Then DoCmd.OpenForm "frmMainData" Else MsgBox "That is not the correct password. Please enter the correct password." End If This all works fine up to a point. First need to "Mask" the Input password. E.G.: Instead of "MyPassword" it should show ********** Second how do You get the Inputbox to prompt 3 times. E.G.: InputBox WrongPassword then InputBox WrongPassword then InputBox WrongPassword then MSGBOX "Dbase is Closing" Have read Microsoft's Supports including "209871 How to Create a Password Protected Form or Report" but that requires a separate form with it's own module and the code is long and cumbersome. Believe the approach described above is a lot simpler and it doesn't take up as much "Real Estate" as Microsoft's solution. Would someone be so kind as to point me in the correct direction? Thank You for reading this post. Andy |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
a complicated linkage | Scott B | Using Forms | 3 | May 16th, 2005 08:24 PM |
how can I show call history of a person on the record | aj20 | General Discussion | 3 | March 13th, 2005 12:53 PM |
Input mask in source table not in form combo list? | 88lbr | General Discussion | 0 | January 20th, 2005 07:37 PM |
Call a function designated in a table | Cosmic | Using Forms | 1 | September 30th, 2004 09:18 AM |
subtracting multi-valued times in one cell | Scott | Worksheet Functions | 2 | February 9th, 2004 01:49 PM |