Search code examples
sql-servervbams-access

DateTime field not Updateable


Here's my code:

strSQL = "UPDATE tblTransactions SET Verifier = '" & strUserName & "' WHERE PatientAccountNumber = '" & Me.PatientAccountNumber & "'"                    
                    
strSQL = "UPDATE tblTransactions SET VerifierAssgnDate = #" & Date & "# WHERE PatientAccountNumber = '" & Me.PatientAccountNumber & "'"

"Verifier" updates fine, but "VerifierAssignDate" throws a "field not updateable" error. It's a DateTime field.

Thanks!


Solution

  • You can and should combine these (and VerifierAssgnDate was probably misspelled):

    strSQL = "UPDATE tblTransactions " & _
        "SET Verifier = '" & strUserName & "', VerifierAssignDate = Date() " & _
        "WHERE PatientAccountNumber = '" & Me.PatientAccountNumber & "'"