S
Sash
I'm trying to create a SQL statement by going through each field, verify if
it's null and then update if it is NOT null. If someone can look at my
thought process and logic. I'm writing to a SQL Server DB.
Below is the first two lines of code to give you an idea of my logic. I do
this for 20 fields ....
strSQL = "UPDATE dbo_Anesth SET "
If Not IsNull(Me.[anesth1]) Then
strSQL = strSQL & "dbo_Anesth.[ip_anesth1] = """ & Trim$(Me.[anesth1]) &
""","
ElseIf Not IsNull(Me.[operation_start_date]) Then
strSQL = strSQL & "dbo_Anesth.[ip_opdate] = """ &
Me.[operation_start_date] & ""","
And end with the following because I know that i will ALWAYS have pat-mrn.
ElseIf Not IsNull(Trim$(Me.[pat-mrn])) Then
strSQL = strSQL & "dbo_Anesth.[ip_ptmrn] = """ & Trim$(Me.[pat-mrn]) &
""" "
End If
strSQL = strSQL & "WHERE dbo_Anesth.[fldpatacct] = """ & stptacct & """;"
it's null and then update if it is NOT null. If someone can look at my
thought process and logic. I'm writing to a SQL Server DB.
Below is the first two lines of code to give you an idea of my logic. I do
this for 20 fields ....
strSQL = "UPDATE dbo_Anesth SET "
If Not IsNull(Me.[anesth1]) Then
strSQL = strSQL & "dbo_Anesth.[ip_anesth1] = """ & Trim$(Me.[anesth1]) &
""","
ElseIf Not IsNull(Me.[operation_start_date]) Then
strSQL = strSQL & "dbo_Anesth.[ip_opdate] = """ &
Me.[operation_start_date] & ""","
And end with the following because I know that i will ALWAYS have pat-mrn.
ElseIf Not IsNull(Trim$(Me.[pat-mrn])) Then
strSQL = strSQL & "dbo_Anesth.[ip_ptmrn] = """ & Trim$(Me.[pat-mrn]) &
""" "
End If
strSQL = strSQL & "WHERE dbo_Anesth.[fldpatacct] = """ & stptacct & """;"