S
sike11 via AccessMonster.com
Hi,
I have the following code in my form:
Private Sub txtQualref_BeforeUpdate(Cancel As Integer)
Dim QR As String
Dim stLinkCriteria As String
QR = Me.txtQualref.Value
stLinkCriteria = "[txtQualref]=" & "'" & QR & "'"
If DCount("txtQualref", "tblQOEDescription",
stLinkCriteria) > 0 Then
'Undo Duplicate Entry
Me.Undo
MsgBox ("WARNING - Qual Ref: " & QR & " is
already in the database." & vbNewLine & "
RECORD DETAILS NOT ADDED!!")
End If
End Sub
The problem is that even when I input a value I know is not in the table, I
still get the error message.
Can anyone help me?
Regards,
Mary.
I have the following code in my form:
Private Sub txtQualref_BeforeUpdate(Cancel As Integer)
Dim QR As String
Dim stLinkCriteria As String
QR = Me.txtQualref.Value
stLinkCriteria = "[txtQualref]=" & "'" & QR & "'"
If DCount("txtQualref", "tblQOEDescription",
stLinkCriteria) > 0 Then
'Undo Duplicate Entry
Me.Undo
MsgBox ("WARNING - Qual Ref: " & QR & " is
already in the database." & vbNewLine & "
RECORD DETAILS NOT ADDED!!")
End If
End Sub
The problem is that even when I input a value I know is not in the table, I
still get the error message.
Can anyone help me?
Regards,
Mary.