I dont do much work in databases, so I need a little help. I am working in Access and creating a form. I am having a user enter a name and a date, I want to check that against my table to make sure that name and date dont already exist.

I have my If statement and loop already written, but when I try ti run it I get this message:

db1 can't find the field '|' referred to in your expression.

Here is the code that I have:

Public Sub error_check()

x = [Homework_Club].[ID]

For i = 1 To x
If [Homework_Club.Student_Name] = Text1 And [Homework_Club.Date = Text22] Then
MsgBox "Student has already been entered for that date", vbCritical, "Error"
End If
Next i

End Sub