Hello Everyone and Happy New Year for You!
I'm working on in a new project in MS Access.
I need that MS Access notify me if a record already exists when I insert new data in the form, in this case the field "Cod".
I attached an simple database example to show you the error that Ms Access gives me.
In the form "Table1" when I try to insert a new record, Ms Access gives me the following error:
"Run-time error '3464' Data type mismatch in criteria expression"
I'm using the folowing code in the form "Table1:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If DCount("[Cod]", "Table1", "[Cod]= '" & Me![Cod] & "'") > 0 Then
MsgBox "Name Is Already In Database!"
End If
End Sub
How can I turn this around?
Thank You For Your Help.
I'm working on in a new project in MS Access.
I need that MS Access notify me if a record already exists when I insert new data in the form, in this case the field "Cod".
I attached an simple database example to show you the error that Ms Access gives me.
In the form "Table1" when I try to insert a new record, Ms Access gives me the following error:
"Run-time error '3464' Data type mismatch in criteria expression"
I'm using the folowing code in the form "Table1:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If DCount("[Cod]", "Table1", "[Cod]= '" & Me![Cod] & "'") > 0 Then
MsgBox "Name Is Already In Database!"
End If
End Sub
How can I turn this around?
Thank You For Your Help.