Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 2nd, 2004, 05:40 AM
mezza1 mezza1 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 12 mezza1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 28 sec
Reputation Power: 0
Unhappy Login Difficulties

I have created a ms access front end to SQL database.

I have used the below vb to create the user login function, but it is
not working, i believe that this is because the 'password' field in the sql database
is set to the password format, is there some extra code i need to enter to get the
login script to work.

** also i am using a different systems user table (so i don';t have to keep it up to date!
but users can change their password, this seeem to then be stored in several fields Password, Password#2, password#3 etc.
so when i need to authenticate users, i will have to check all these password fields to make sure....

any help would be greatly appreciated...

Private Sub cmdLogin_Click()
If IsNull(Me.username) Or Me.username = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.username.SetFocus
Exit Sub
End If
If IsNull(Me.pword) Or Me.pword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.pword.SetFocus
Exit Sub
End If
If Me.pword.Value = DLookup("[Password]", "tblUser", "[PayrollNo]=" & Me.username.Value) Then
MyPayrollNo = Me.username.Value
DoCmd.Close acForm, "LogOn", acSaveNo
DoCmd.OpenForm "Welcome"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.pword.SetFocus
End If
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database.Please contact admin.", vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub

thanks

Reply With Quote
  #2  
Old December 2nd, 2004, 08:05 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi mezza1,

You said it wasn't working, but didn't indicate where in the code it was failing. One thing I did notice was your DLookup function. Is [PayrollNo] a number or the name of the user? Me.username.Value appears to be a text (users name) and if you are trying to match a number to a text it will obviously fail at this point.

You may want to step through the code and see where it is failing, but I have a hunch it has to do with your DLookup function that has the wrong "Where" criteria or syntax. Keep in mind when using a text in your Where clause, you will need to include the quotes marks. Example:

Dim strUser As String
strUser = username
Me.pword.Value = DLookup("[Password]", "tblUser", "[PayrollNo]='" & strUser & "'")

The above syntax assumes that [PayrollNo] is the column/field in your table "tblUser" that contains the user name.

lwells

Reply With Quote
  #3  
Old December 2nd, 2004, 10:03 AM
mezza1 mezza1 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 12 mezza1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 28 sec
Reputation Power: 0
Question

Thanks IWells,

the payrollno and the username are the same data type..both are text..so this presumably should work?

I have a feeling it is the password field in sql, when you view this field is shows up as 'TT6UF37XXUHAUCX8Y6>6;64PSAF6VO8@S;TXPYHF7LX0U6IQ@B2;NIC321295694209.. ...etc etc'

when i tried this as a simple login with actual password in a field in the local table is worked, so i think the way the password is stored may be affecting the lookup..

any ideas?

Cheers

Mezza1

Reply With Quote
  #4  
Old December 2nd, 2004, 11:03 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Did you place your quotation marks in your DLookup function for text?

lwells

Reply With Quote
  #5  
Old December 3rd, 2004, 05:17 AM
mezza1 mezza1 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 12 mezza1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 28 sec
Reputation Power: 0
Wink

Hi,

yes, i had forgotton that the MyPayRollNo was declared as long in a public module, as soon as i changed this to a string it worked.

Thanks very very much for your help.

Cheers

Mez


Quote:
Originally Posted by lwells
Did you place your quotation marks in your DLookup function for text?

lwells

Reply With Quote
  #6  
Old December 3rd, 2004, 08:12 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Mezza1,

Excellant, how in the world did you find that one? I would have never thought to look there. Is is possible that you could share that portion of your module with me. I would love to make a simulation for debugging purposes. If you don't want to post here, send it to me via my email or if you don't want to disclose this module for security purposes, I would certainly understand. I was just intrigued with this particular problem and how it was solved.

Thanks,
lwells

Reply With Quote
  #7  
Old December 3rd, 2004, 08:41 AM
mezza1 mezza1 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 12 mezza1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 28 sec
Reputation Power: 0
Question

It was just the following

Option Compare Database

Public MyPayrollNo As String

save in a module (any name). as soon as i changed it to 'As String' it worked!


I have deceideD that the way the other team change/admin the passwords is not great, and so i am hoping to use the 'sysusers' table that SQL server security applies to the database, the only problem is that passwords are stored as binary as ideas on how to get this to work in that situation?


Mez

Quote:
Originally Posted by lwells
Hi Mezza1,

Excellant, how in the world did you find that one? I would have never thought to look there. Is is possible that you could share that portion of your module with me. I would love to make a simulation for debugging purposes. If you don't want to post here, send it to me via my email or if you don't want to disclose this module for security purposes, I would certainly understand. I was just intrigued with this particular problem and how it was solved.

Thanks,
lwells

Reply With Quote
  #8  
Old December 3rd, 2004, 05:08 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Mez,

Afraid I can't help you with that one. But I will look around and see if I can find something that might be helpful. Possibly someone else has an answer and will post here for you.

lwells

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Login Difficulties


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway