BUG: Error Message 2046 Calling OpenForm or OpenReport with Access Automation (244695)
The information in this article applies to:
This article was previously published under Q244695 SYMPTOMS
When you automate Microsoft Access and call either the OpenForm or OpenReport method, you receive one of the following errors:
Run-time error '2046':
The command or action 'OpenForm' isn't available now.
-or-
Run-time error '2046':
The command or action 'OpenReport' isn't available now.
CAUSE
This problem occurs when the Database window is hidden at the time you call the OpenForm or OpenReport method from automation.
RESOLUTION
You can work around this problem by doing one of the following:
- Make sure the Database window is shown before calling the OpenForm or OpenReport method. See "Workaround 1" below for a code sample.
- Create a module in the Access database that contains the code to open the form or report, then call that procedure from automation using the Run method. See "Workaround 2" below for a code sample.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 7/14/2004 |
---|
Keywords: | kbAutomation kbbug kbpending KB244695 |
---|
|