Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User ID & Password lookup

Status
Not open for further replies.

GessTechie

Technical User
Jan 24, 2003
10
US
Hello....

I have a form that I use as a gateway to a database. The form asks for a User ID and Password that I have stored in a separate table.

On click of a button, I want to determine if the user entered the correct User ID and Password based upon the User ID table. If they have, it continues to another form for data entry. If not, I want a msgbox to display "Incorrect User ID & Password combo."

I need help determining the best solution.

Thanks
 
On the command button On Click event:

'Check for vaild UserName first
If IsNull(Dlookup("[Username]","Employees","[Username] = '" & Me![UserName & "'")) then
MsgBox "You have entered an invalid UserName. Please Re-Enter your UserName.", VBOKOnly, "Incorrect UserName."
Me![Username] = Null
Me![Username].SetFocus
Exit Sub
End If

'Check for valid Password for UserName
If Dlookup(&quot;[Password]&quot;,&quot;Employees&quot;,&quot;[Username] = '&quot; & Me![UserName & &quot;'&quot;) <> Me![Password] then
MsgBox &quot;You have entered an invalid Password. Please Re-Enter your Password.&quot;, VBOKOnly, &quot;Incorrect Password.&quot;
Me![Password] = Null
Me![Password].SetFocus
Exit Sub
End If
Anthony J. DeSalvo
President - ScottTech Software
&quot;Integrating Technology with Business&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top