Reputation: 385
I have a ms access database and when I try to update a column in a module I get the error "Mismatch datatype criteria expression", when I create the column the datatype was TEXT(25) and the value that I'm trying to assign is a String:
Dim str As String
str = "test"
sql = "UPDATE Table "
sql = sql & "SET Table.[column] ='" & str & "' "
sql = sql & "WHERE Table.[id] = 1;"
MsgBox(sql)
Application.CurrentDb.Execute(sql)
In the MsgBox
the string of query appears to be right: "UPDATE Table SET Table.[Column]='test' WHERE Table.[id]=1;
Which is the error?, how to fix this?
Upvotes: 0
Views: 98
Reputation: 112279
If Table.id
is a numeric column your where clause is okay, but if it is a text column it should read:
WHERE Table.id = '1'
Upvotes: 1