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
  #2  
Old June 8th, 2004, 08:47 PM
John Vinson
external usenet poster
 
Posts: n/a
Default Table with Password Field

On Tue, 8 Jun 2004 11:30:21 -0400, "Techsupport" wrote:

If there is no password in the table then do
this


If IsNull(DLookUp("Password", ...


John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
  #3  
Old June 9th, 2004, 07:14 AM
John Vinson
external usenet poster
 
Posts: n/a
Default Table with Password Field

On Tue, 8 Jun 2004 15:58:21 -0400, "Techsupport" wrote:

John, can you tell me what's wrong with this statement?

If IsNull(DLookup("Password", "tblLogin", "[UserName]=" & Me.Username) Then

I get a "Compile Error: Expected: List Separator or )" error message

Thanks


If UserName is a text field you need quotemarks; you also need another
closing paren, they're unmatched. Try


If IsNull(DLookup("Password", "tblLogin", "[UserName]='" & Me.Username
& "'")) Then

Note that if the Username control is empty this will look for a blank
username (and probably find none).

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public

  #4  
Old June 9th, 2004, 05:49 PM
John Vinson
external usenet poster
 
Posts: n/a
Default Table with Password Field

On Wed, 9 Jun 2004 09:25:21 -0400, "Techsupport" wrote:

Ok...this is becoming a nightmare...The frmLogin checks if the user has a
password in the table, and if not, it opens another form (bound to tblLogin)
and requires that the user put in a new password. There are several users,
but the password is saved on the first record instead of saving it in the
user's record. Any idea?


Sorry! The textbox into which the user types the password should be
*unbound*. Otherwise it will overwrite the password in the selected
record.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
  #5  
Old June 10th, 2004, 12:47 AM
John Vinson
external usenet poster
 
Posts: n/a
Default Table with Password Field

On Wed, 9 Jun 2004 12:58:23 -0400, "Techsupport" wrote:

John, could I send you the forms involved in this so you can take a look?


Yes... but I'll need a billing address to send my invoice at my
current consulting rates. They're not particularly cheap. Still
interested?

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 07:34 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.