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
|
|||
|
|||
Table with Password Field
On Mon, 7 Jun 2004 10:28:42 -0400, "Techsupport" wrote:
My question is: how do I set the password field NOT to auto-enter the password automatically when a user selects his/her name from the drop-down box and how do I code the verification of the password from the table? I'd suggest using an *unbound* textbox - set its Control Source to blank. You can also set its Input Mask property to Password, so when the user types only a string of asterisks will show up on the screen (to foil shoulder-peepers). In the textbox's BeforeUpdate event use code like: Private Sub txtPassword_BeforeUpdate(Cancel as Integer) Dim iAns As Integer If Me!txtPassword DLookUp("[Password]", "[tablename]", _ "[Username] = """ & Me!cboUsername & """") Then iAns = Msgbox("Invalid password. Try again?", vbYesNo) If iAns = vbYes Then Cancel = True Else Me.Undo DoCmd.Close acForm Me.Name End If End Sub If you want the password to be case-sensitive it's doable but a bit more complex - use the StrComp() function, check the online VBA help for details. John W. Vinson[MVP] Come for live chats every Tuesday and Thursday http://go.compuserve.com/msdevapps?loc=us&access=public |
Thread Tools | |
Display Modes | |
|
|