ACC2000: Opening and Closing a Form Hundreds of Times Noticeably Affects System Resources (248910)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q248910
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SYMPTOMS

In a Microsoft Access database or project running on Microsoft Windows 95 or Microsoft Windows 98 in which a form is opened and closed hundreds of times during the same session, the system becomes slow to respond, and you may see the following error messages:
There isn't enough memory to update the display. Close unneeded programs and try again.

-and-

Microsoft Access was unable to create a window. The system is out of resources or memory. Close unneeded programs and try again.

For more information on freeing memory, search the Microsoft Windows Help index for 'memory, troubleshooting'.

CAUSE

Each time that an Access form is opened and closed in Windows 95 or Windows 98, a small amount of System GDI resources used for fonts is taken and not released. This goes unnoticed in most situations; however, if you have a database that stays open for long periods of time, such as in a 24x7 environment, and a form in that database is repeatedly opened and closed perhaps hundreds of times, you may eventually see performance problems or out-of-memory errors. The number of times that you can open a form before you see this behavior varies because it depends upon the complexity of the form and also what other programs may be running in Windows.

NOTE: The number of times that you can open and close a form before you see these symptoms is smaller for some international versions of Access 2000 that are more font intensive, such as Chinese; therefore, you may see this problem more frequently in these versions.

RESOLUTION

To resolve this problem, obtain Microsoft Office 2000 Service Release 1/1a (SR-1/SR-1a).

To obtain SR-1/SR-1a, click the article number below to view the article in the Microsoft Knowledge Base:

245025 OFF2000: How to Obtain and Install Microsoft Office 2000 Service Release 1/1a (SR-1/SR-1a)

To temporarily work around this problem, free system resources. To do so, close all instances of Access, and then reopen the database.

NOTE: This issue does not occur in Windows NT or Windows 2000.

If you are automating the opening and closing of a form repeatedly with the SendKeys method, you should instead use the DoCmd.OpenForm and DoCmd.CloseForm methods. These methods do not cause this behavior.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
This problem was corrected in Microsoft Office 2000 SR-1/SR-1a.

MORE INFORMATION

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

Steps to Reproduce Behavior

  1. On a computer running Windows 95 or Windows 98, open the sample database Northwind.mdb.
  2. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  3. In the Visual Basic Editor, type or paste the following code:
    Function memFormTest(stTestForm As String, intIter As Integer)
    
        Dim i As Integer
        
        DoCmd.SelectObject acForm, stTestForm
        
        For i = 1 To intIter
            Debug.Print "Opening form " & stForm & " for the " & i & " time"
            SendKeys "{F11}", False: DoEvents
            SendKeys "%o", False: DoEvents
            SendKeys "^{F4}", False: DoEvents
        Next
        
    End Function
    					
  4. On the File menu, click Save Northwind.
  5. Leave the Visual Basic Editor open, and then return to Access. Open the Categories form.
  6. With the Categories form as the active form, press ALT+F11 to return to the Visual Basic Editor.
  7. Type the following line in the Immediate window, and then press ENTER:
    ?memFormTest("Categories","2000")
    						
    You see Access now opening and closing the Categories form.

    IMPORTANT: Leave the computer undisturbed until you see an error. Do not touch the keyboard or mouse.
  8. After you see one of the error messages noted in the "Symptoms" section, click OK a few times to see each of the two errors listed in the "Symptoms" section.
  9. After viewing the errors, press CTRL+BREAK until the procedure stops running.
  10. In the Visual Basic Editor, scroll down to the bottom of the Immediate Window. There you see the number of times it took for the loss of system resources to become serious.

    NOTE: This number may vary from system to system.

Modification Type:MajorLast Reviewed:11/25/2002
Keywords:kbbug kberrmsg KB248910