J
JOM
I am trying to enter information on a form. I have a txt box that if I enter
information should first check for duplicates and if there is a duplicate,
alert me, but if not a duplicate allow me to continue entering information.
I did find some valuable infor in the newsgroup but when I tried it, its not
working well for me.
Whenever I enter the rqstNo, whether its a duplicate or not, the duplicate
popup keeps showing. How will take care of that
he is my code......
Private Sub RqstNo_BeforeUpdate(Cancel As Integer)
Dim iAns As Integer
If Not IsNull(DLookup("RqstNo", "TblRqst", "RqstNo = " & RqstNo)) Then
iAns = MsgBox("Duplicate Number!" & vbCrLf & " Click OK to try a
different one," _ & " Cancel to erase the entire record and try over",
vbOKCancel,)
Cancel = True
If iAns = vbCancel Then
Me.Undo
Else
Me!RqstNo.Undo
'Me!RqstNo.SetFocus
End If
End If
information should first check for duplicates and if there is a duplicate,
alert me, but if not a duplicate allow me to continue entering information.
I did find some valuable infor in the newsgroup but when I tried it, its not
working well for me.
Whenever I enter the rqstNo, whether its a duplicate or not, the duplicate
popup keeps showing. How will take care of that
he is my code......
Private Sub RqstNo_BeforeUpdate(Cancel As Integer)
Dim iAns As Integer
If Not IsNull(DLookup("RqstNo", "TblRqst", "RqstNo = " & RqstNo)) Then
iAns = MsgBox("Duplicate Number!" & vbCrLf & " Click OK to try a
different one," _ & " Cancel to erase the entire record and try over",
vbOKCancel,)
Cancel = True
If iAns = vbCancel Then
Me.Undo
Else
Me!RqstNo.Undo
'Me!RqstNo.SetFocus
End If
End If