Hi
This is my code:
mypro is string
prID is autonumber field
shows this error:Code:CurrentDb.Execute "delete from protbl where prID='" & mypro & "'"
Data type mismatch in criteria expression
Hi
This is my code:
mypro is string
prID is autonumber field
shows this error:Code:CurrentDb.Execute "delete from protbl where prID='" & mypro & "'"
Data type mismatch in criteria expression
Wouldn't it be CurrentDb.Execute "DELETE * from protbl where prID='" & mypro & "'" ??
Also to be sure you string is correct I would
Dim test_string as String
test_string = "DELETE * from protbl where prID='" & mypro & "'"
MsgBox(test_string)
Hope this helps.
For a numeric field:
CurrentDb.Execute "delete * from protbl where prID=" & mypro
An AutoNumber field is a Long Integer (numeric) so your code should be:
CurrentDb.Execute "Delete * from protbl where prID=" & mypro
...*not* enclosed in quotes.
Edit: Darn, those lower altitudes let's Paul type faster.
Oops apparently didn't take enough time to read the numeric field part. Sorry
It is a real good thing that Paul and I have never made that mistake!