ACC2002: Microsoft Access Quits When You Programmatically Switch Views on Open Tables or Queries (295242)
The information in this article applies to:
This article was previously published under Q295242 Novice: Requires knowledge of the user interface on single-user computers.
This article applies only to a Microsoft Access database (.mdb).
SYMPTOMS
When you use Visual Basic for Applications (VBA) code to switch between views on open tables or queries, you may receive the following error message, and then Microsoft Access quits:
Microsoft Access has encountered a problem and needs to close. We are sorry for the inconvenience.
When you view the details in the error report, the report states that an error has occurred in Msaccess.exe.
CAUSE
You receive the error message if the table or query is currently open.
RESOLUTION
If you must change the view of the table or query, you must modify your code to first close the open table or query, and then reopen the table or query for the view that you want.
For the example in the "Steps to Reproduce the Behavior" section later in this article, you can change the code and correct the behavior as follows:
- For the Customer Table in Print Preview command button, make the following code changes:
DoCmd.Close acTable, "customers"
DoCmd.OpenTable "Customers", acViewPreview - For the Switch Customer Table to Design View command button, make the following code changes:
DoCmd.Close acTable, "customers"
DoCmd.OpenTable "Customers", acViewDesign
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 9/25/2003 |
---|
Keywords: | kbbug kberrmsg kbnofix KB295242 |
---|
|