Checking two Fields at once

ChampionDuy

Registered User.
Local time
Today, 00:04
Joined
Mar 14, 2002
Messages
94
I have two fields where a user inputs data. These two fields make up the primary key. When the user enters in the data, a button is suppose to check whether or not that exact record is in the table. What is the best or easiest code to write to check and make sure that those two fields which are in the same record are in the table. An example would be a user login form, where the user enters in a username and a password and I need to check that the individuals user name matches his password, which is stored in the same record and the user name and password make up the primary key (aka composite key). If this question is hard to understand please let me know.
 
Code:
If Dlookup("YourField", "YourTable", "[KeyPart1] = " & Me.Textbox1 & " And [KeyPart2] = " & Me.Textbox2 & ") Then
   MsgBox "Already in System"
   Exit Sub
End If
 
Thank you

Thank you very much I will try that right now
 

Users who are viewing this thread

Back
Top Bottom