A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Table with Password Field



 
 
Thread Tools Display Modes
  #1  
Old June 8th, 2004, 07:57 AM
John Vinson
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:13 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.