I am a beginner and have problem with a record look up. I have created a form with an unbound text box. I want to enter a problem number in the box. I am trying to create three outcomes. 1. I receive a message if the box is empty. 2. if I put in a problem number I want to query a table to see if it exists, If it exists I get a message. 3. if it doesn't exist I want to open another form. My problem is that I can not get the Dlookup to run. What is wrong witht he code. I have included all the code.
Private Sub number_Enter()
If IsNull(Me!number) Then
MsgBox "ServiceCenter Problem Ticket is a Required Field.", 48
Me!number.SetFocus
Else
If IsNull(DLookup("[number]", "ServiceCenterProblem", "[number] = '" + Me!number + "'") Then
MsgBox "Problem Ticket already exists, Please enter another Ticket.", 48
Me!number.SetFocus
End If
End If
End Sub
Private Sub number_Enter()
If IsNull(Me!number) Then
MsgBox "ServiceCenter Problem Ticket is a Required Field.", 48
Me!number.SetFocus
Else
If IsNull(DLookup("[number]", "ServiceCenterProblem", "[number] = '" + Me!number + "'") Then
MsgBox "Problem Ticket already exists, Please enter another Ticket.", 48
Me!number.SetFocus
End If
End If
End Sub