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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form that Asks for UserID/Password & Checks Table 1

Status
Not open for further replies.

ChemistZ

Programmer
Oct 30, 2001
70
US
I need help. I have a form that asks for a person's user id and password and I want it to then check what they enter to see if it exists in my Security table in the database. I am storing what they enter in a global variable but I am getting multiple error messages when I try to use a For...Next Loop to check the Fields collection. Help!!!
 
Hi!

Try this:

Dim rst As DAO.Recordset

Set rst = CurrentDb.OpenRecordset("tblSecurity", dbOpenDynaset)

rst.FindFirst "fldLANName = '" & txtLANName & "'"
If rst.NoMatch = True Then
Call MsgBox("The name you typed in is not valid.")
ElseIf rst!fldPassword <> txtPassword Then
Call MsgBox(&quot;The password you used does not match the name&quot;)
Else
Continue into database(open form whatever you do
End If

Set rst = Nothing

hth
Jeff Bridgham
bridgham@purdue.edu
 
I saw your post to my question but I am apparently brain dead. I am unable to pass it the values of the variables properly. At the top of the form module, I have declared two variables &quot;strRACFID&quot; for the USERID and &quot;strPassword&quot; for the password. I have started the code with two assignment statements like
strRACFID=[RACFID] - the name I gave the text box on the form
strPassword=[Password] - &quot;&quot;
Then I put in your code replacing the part after FindFirst with [RACFID]=strRACFID - no quotation marks
and the part after rst! with [Password] <> strPassword but it isn't really checking the table because I can type in any USERID and get the message after Password. Can you help?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top