.NET Questions and Solutions

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘run time error’

BUG: Starting Word Manually Uses Same Instance as Automation

Symptoms
You run a Visual Basic application that uses the CreateObject function tostart a hidden instance of Microsoft Word. The application is idle, but itstill maintains a reference to Word. Next, you manually start an instanceof Word. A separate instance of Word should open, but the same instancethat was created by the Visual Basic application is made active instead. Ifyou close Word and continue to work in the Visual Basic application, one of the following errors occurs when the application tries to use Word objectsbecause Word is no longer running:

Run-time error ‘462′:
The remote server machine does not exist or is unavailable
-or-

Run-time error ‘-2147023174 (800706ba)’:
Automation errorThis automation error translates to “The RPC server is unavailable.”
Resolution
Use one of the following to work around this problem:Before you create your Word object, first create a temporary Wordobject. After you create your object, close the temporary object. Thiscauses Word to act properly when you control it through Automation (thatis, if a user interactively starts Word, a new instance of Word isopened for the user). The automation instance remains hidden andseparate. See the Steps to Reproduce Behavior section for an example ofthis workaround.Make the Word object visible immediately after using the CreateObjectfunction. This workaround is only for Microsoft Word 97. For example:

Set wrdApp = CreateObject(“Word.Application”)wrdApp.Visible = True

ACC2000: Properties Collection Returns Error for CurrentProject and CurrentData Objects

Symptoms
All object collections under the CurrentProject and CurrentData objects contain a Properties collection. However, when you try to refer to the Properties collection of any object in a collection under the CurrentProject or CurrentData object, you may receive the following error message:

Run-time error ‘2467′:
The expression you entered refers to an object that is closed or doesn’t exist.
Resolution
Although you cannot use the Properties collection to refer to properties of these objects, you can refer to the properties directly. For example, use:

Debug.Print CurrentData.AllTables(1).Name instead of:

Debug.Print CurrentData.AllTables(1).Properties(“Name”)

“ActiveX component can’t create object” error message when you use Data Access Objects version 3.0 (DAO 3.0)

Symptoms
When you use Microsoft Data Access Objects version 3.0 (DAO 3.0) with the products listed at the beginning of this article, you may receive the following error message:

Run-time error ‘429′: ActiveX component can’t create object.
Resolution
This error message occurs when both of the following conditions are true: You are referencing the DAO 3.0 object library.
-and- You are using the CopyFromRecordset method in your macro.