Share via

Access stays in memory after close if any VBA code for Form has been run

Anonymous
2022-02-03T11:13:21+00:00

Since today I've been encountering following problem with my Access DB - whenever I run any VBA code on my Form, Access stays open after closure and locks my DB file - I cannot open it anymore unless I close the process in Task Manager. Additionally it sometimes creates .laccdb file that stays there also until I force-close it with task manager (after I tried restarting the whole PC, it shows no more these files, but DB stays locked anyways).

From what I read, there could be issues with not closing db.RecordSet and I do open them in my code, however I've been always closing them and if I go line by line through code, I make sure these rs.Close are getting executed.

Moreover, if I do almost whatever code on form, it gets stuck. After testing I could conclude that:

  • When I work with anything else, e.g. Tables, Queries, and not Forms - the bug does not appear
  • When I had commented the whole Form code - the bug does not appear
  • When I run even slight Form manipulation with code - it is getting stuck.
  • If I run even mere mock-code without actually changing anything - it gets stuck

More precise examples are:

  • I have Combobox-based filtering on my form to get single record, using code like: Me.Filter = "[Company] = '" & Me.cbo.Column(0) & "'" & _
              " AND [Name] = '" & Me.cbo.Column(1) & "'" & _ 
    
              " AND [Project] = '" & Me.cbo.Column(2) & "'" 
    
      DoCmd.RunCommand acCmdApplyFilterSort 
    

After exectuing it and omitting subequent code, DB is getting stuck. Also this form does not open any DAO/ADO objects, no recordset, etc.

  • I have another form with more complex Combobox filtering (2 Comboboxes, second is a "sub-filter" of the first). When I select value in the first one, a function is fired to produce a query with sub-options for second combobox (e.g. first is to select "Project" and second is to select sub-part of each project). Code is like: x = Chr(34) & CStr(Form.cbo.Value) & Chr(34) sSubSource = "SELECT " & tableName & ".[subProject] " & _
                 "FROM " & tableName & " " & _ 
    
                  "WHERE " & tableName & ".[Project Number] = " & x & ";" 
    

I basically assign query string to a variable, but do not even use it - my DB is already stuck after executing just these lines...

Did anyone had experienced such behaviour and have possible solutions? Need to note that until today (Feb 3rd 2022) these functions worked without any issues. I thought these might be some new functions I've added, but now, my old versions of the database, where I did not make any changes for few months also have this stucking pattern.

Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2022-02-03T13:06:14+00:00

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments

Answer accepted by question author

  1. ScottGem 68,810 Reputation points Volunteer Moderator
    2022-02-03T13:05:16+00:00

    Several people are reporting this problem. It appears to be a bug in a recent update. the solution is to rollback your update.

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2022-02-03T23:29:25+00:00

    Was this answer helpful?

    0 comments No comments