Unanswered: Insert Null Value through UPDATE function
I'm trying to do the following:
Given certain criteria, I want to use the Update funtion to update a specific field in a field with a null value.
Private Sub Readmitted_Click()
Dim Q As VbMsgBoxResult
Dim A As String, B As String, C As String
Dim strSql As String
A = "UPDATE tblCases SET tblCases.[Discharge Date] = NULL WHERE(((tblCases.ClientID)="
B = ")"
If Readmitted.Value = -1 Then
Q = MsgBox("Fred", vbYesNo)
If Q = vbYes Then
strSql = A & Me.ClientID.Value & B
Happy to help. The query designer likes to put all those parentheses in. I always take the extraneous ones out when creating SQL in VBA (in your case, that's all of them). They're just too confusing otherwise.
One other question:
If I wanted to make multiple fields to null (in the SET section), would I just rewrite the tblCases.[Discharge Date] = NULL like this:
UPDATE tblCases SET tblCases.[Discharge Date] = NULL AND tblCases.[Date Referal]= NULL AND tblCases.[Active Start Date]= NULL AND tblCases.[Discharge Code]= NULL