Full Version: Updating Date/time to "Empty/Null"...whatever
UtterAccess Discussion Forums > Microsoft® Access > Access Date + Time
gusaroni
Hi There. I'm new here, but it looks like there's some good info out there, so I'm optimistic about getting myself some answers!

What I'm doing is nothing more than trying to run an update query, and I'm fairly certain that my problems are coming from the date field, but I've rewritten this thing a bunch of times, so it could be anything at this point. I'm getting a syntax error from an SQL statement that translates to the following:

"UPDATE tblCallActionLog SET Action = 'Sample 2',
ActionComplete = False,
ActionCompletedBy = Null,
ActionCompletedDate = Null,
WHERE ActionIdNum = 7"

None of the above fields are required

My code follows:

If isEditing Then
ActionComplete = IIf(Forms!frmMainDataWindow.chbxActionCompleted = 0, False, True)

If Forms!frmMainDataWindow.cbxActionCompletedBy.Value = "" Then
ActionCompletedByString = "ActionCompletedBy = Null"
Else
ActionCompletedByString = "ActionCompletedBy = '" + Forms!frmMainDataWindow.cbxActionCompletedBy.Value + "'"
End If

If Forms!frmMainDataWindow.txtActionCompletedDate.Value = "" Then
ActionCompletedDateString = "ActionCompletedDate = Null"
Else
ActionCompletedDateString = "ActionCompletedDate = #" + Forms!frmMainDataWindow.txtActionCompletedDate.Value + "# "
End If

SQLText = "UPDATE tblCallActionLog SET Action = '" + Action + "', " & _
"ActionComplete = " + Str(ActionComplete) + ", " & _
ActionCompletedByString + ", " & _
ActionCompletedDateString + ", " & _
"WHERE ActionIdNum = " + Str(sbfrmCallActionLog!ActionIdNum)

Else
SQLText = "INSERT INTO tblCallActionLog " & _
"(IncomingCallID, ClientSerNum, [Action])" & _
" VALUES('" + Str(IncomingCallID) + "', '" + Str(ClientSerNum) + " ', '" + Action + "')"
End If


dbsCurrent.Execute SQLText


Any input on this subject would be greatly appreciated.


Thanks!
gusaroni
Please disregard above. I had an extra comma in there.


Duh!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.