I have the following vba sql statement to update and table with fields in time format. Every time I run it, I get Run-time error 3464. Data type mismatch in criteria expression.
The code is -
strSQL = "Update TempSchedfunction set " & _
"[EndTime] = '" & IIf(IsNull(Me.EndTime), Null, Me.EndTime) & "'"
DoCmd.SetWarnings False
db.Execute strSQL, dbFailOnError
EndTime is in medium Time format
if the endtime field is null then I want to update TempSchedfunction table with a null value otherwise retreive the value of the EndTime field.
If I remove the IIF and Is null statement, and the EndTime field has a value, the update works find. But when I do the IIF to check see if the field is null or not, I get the message.
I must be missing something basic. I have spent days on this without success. Can anyone help me.
The code is -
strSQL = "Update TempSchedfunction set " & _
"[EndTime] = '" & IIf(IsNull(Me.EndTime), Null, Me.EndTime) & "'"
DoCmd.SetWarnings False
db.Execute strSQL, dbFailOnError
EndTime is in medium Time format
if the endtime field is null then I want to update TempSchedfunction table with a null value otherwise retreive the value of the EndTime field.
If I remove the IIF and Is null statement, and the EndTime field has a value, the update works find. But when I do the IIF to check see if the field is null or not, I get the message.
I must be missing something basic. I have spent days on this without success. Can anyone help me.