Forum Discussion

Steve Backman's avatar
Steve Backman
Copper Contributor
Nov 16, 2022

Can't update DAO recordset - Access crashes and closes

I have a database that has hardly changed in many years. Using it today (11/15), at least some DAO recordset operations cause it to crash and close with no message. It last worked just fine a month ago (10/13).  I have excerpted  from the code (which is either adding or recreating an invoice)

 

Dim db As DAO.Database 
Dim rstInv As DAO.Recordset

Dim sql as String

...

lngInvoiceNo - 1234  'for example

sql = "SELECT * FROM Invoices Where InvoiceID = " & lngInvoiceNo
Set rstInv = db.OpenRecordset(sql)
With rstInv
    If .RecordCount Then
      .Edit
   Else
     .AddNew
       rstInv!InvoiceID = lngInvoiceNo '''' dies here
       rstInv!InvDate = varInvDate
    End If

 

Access pauses at the marked line, then just closes entirely. I have taken steps to make sure its not the data, and similar things happening throughout the db. I found one windows office update in the last month and uninstalled it. It feels like my syntax is no longer valid though I have no errors in my references list and the VBA compiles. 

 

Any thoughts on this most welcome, needless tosay.

 

(Ugh, this is not my usual profile here...) 

3 Replies

Resources