title: Why does Recordset.Update not always work?
body: <p>I'm working on a database in MS Access. Since it has a fair amount of VBA code, I've neatly split up the code into different modules, and implemented an error handler which writes the error into a table into the database. I've never had any problems with it, until there was an error in the login system (runtime error 49: &quot;invalid use of null&quot; or something similar - my system is set up in German). In that case, for some reason, the error doesn't get logged. I've been able to reproduce this on two machines. I've fixed the error in the meantime, but I want to know why it didn't log the error properly, because I want the error reporting to work properly.
  Here's the code in my error handler:</p>
  <pre><code>Public Function RuntimeError(Location As String, ErrNumber As String, ErrSource As String, ErrDescription As String, ErrHelpFile As String, ErrHelpContext As String, ErrLastDLLError As String)
      On Error GoTo Fehler
      Dim LVDB As DAO.Database
      Set LVDB = CurrentDb
      Dim LUKSVDB_Fehler As DAO.Recordset
      Set LUKSVDB_Fehler = LVDB.OpenRecordset(&quot;LUKSVDB_Fehler&quot;)
      LUKSVDB_Fehler.AddNew
      LUKSVDB_Fehler!Location = Location
      LUKSVDB_Fehler!ErrNumber = ErrNumber
      LUKSVDB_Fehler!ErrSource = ErrSource
      LUKSVDB_Fehler!ErrDescription = ErrDescription
      LUKSVDB_Fehler!ErrHelpFile = ErrHelpFile
      LUKSVDB_Fehler!ErrHelpContext = ErrHelpContext
      LUKSVDB_Fehler!ErrLastDLLError = ErrLastDLLError
      LUKSVDB_Fehler!Person = User
      LUKSVDB_Fehler!Zeit = Now
      'Ask the user if they would like to add any aditional information, like what they did to cause the error
      If ErrDescription &lt;&gt; &quot;Folgefehler&quot; Then LUKSVDB_Fehler!Nutzererklärung = InputBox(&quot;Es ist ein Fehler aufgetreten. Kannst du noch ein paar Angaben machen, was du gemacht hast, um die Fehlerbehebung zu erleichtern? Details für den Entwickler: &quot; &amp; Location &amp; &quot; &quot; &amp; ErrNumber &amp; &quot; &quot; &amp; ErrSource &amp; &quot; &quot; &amp; ErrDescription &amp; &quot; &quot; &amp; ErrHelpFile &amp; &quot; &quot; &amp; ErrHelpContext &amp; &quot; &quot; &amp; ErrLastDLLError &amp; &quot; &quot; &amp; User, &quot;Systemfehler&quot;)
      LUKSVDB_Fehler.Update
  'error handling logic
  Done:
      Exit Function
  Fehler:
      MsgBox &quot;Die Fehlermeldung konnte nicht gespeichert werden. Bitte diese Informationen dem Entwickler mitteilen: &quot; &amp; Location &amp; &quot; &quot; &amp; ErrNumber &amp; &quot; &quot; &amp; ErrSource &amp; &quot; &quot; &amp; ErrDescription &amp; &quot; &quot; &amp; ErrHelpFile &amp; &quot; &quot; &amp; ErrHelpContext &amp; &quot; &quot; &amp; ErrLastDLLError &amp; &quot; &quot; &amp; User &amp; &quot;. Fehler beim Speichern: &quot; &amp; Err.Number &amp; &quot; &quot; &amp; Err.Source &amp; &quot; &quot; &amp; Err.Description &amp; &quot; &quot; &amp; Err.HelpFile &amp; &quot; &quot; &amp; Err.HelpContext &amp; &quot; &quot; &amp; Err.LastDllError, vbCritical
      DoCmd.Quit
  End Function
  </code></pre>
  <p>I've checked to make sure that none of the fields in the table are required (except for the primary key, which is an autonumber field anyway). The weird thing is, usually, it works, but in some constellations obviously not. It also doesn't throw an error. Here are the values the function RuntimeError gets that somehow makes it not work:</p>
  <pre><code>  : Location : &quot;Form_Willkommen: Form_Open&quot; : String
    : ErrNumber : &quot;94&quot; : String
    : ErrSource : &quot;LUKS-Verwaltung&quot; : String
    : ErrDescription : &quot;Unzulässige Verwendung von Null&quot; : String
    : ErrHelpFile : &quot;C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA7.1\1031\VbLR6.chm&quot; : String
    : ErrHelpContext : &quot;1000094&quot; : String
    : ErrLastDLLError : &quot;0&quot; : String
  </code></pre>
  <p>If I stop the code on the <code>LUKSVDB_Fehler.Update</code> line and look into the local values, everything seems to be fine. All the values have been added to the record, it also has a value for the primary key, but as soon as it hits Update, it just seems to throw it all out of the window, but it also doesn't generate an error, either.
  I've also tried the force option on the <code>.Update</code> method in the hopes that it throws an error so I can see exactly what's not working, but that isn't very well documented, and I can't seem to get the syntax right (I tried <code>.Update , True</code>).
  Does anyone have any idea what I could be doing wrong, or how I could get it to give me a proper error when <code>.Update</code> doesn't work?
  In case it matters, I'm using Access on Office 365.</p>