Hi,
I'm developing a simple database of Word documents in Access.
WORD
ACCESS
I didn't work on the project for several months. Now, back on it, I discovered a strange and not constant behaviour.
IF the file is launched from Word, everything is always fine.
IF the file is launched from Access clicking in the BoundObjectFrame, most of the time my checks are non passed because Word will not find an ActiveDocument.
Every call to the ActiveDocument, also in the first line of the Document_Open routine, will trow the error 4228 "The command is not available because the document is not open" or ".. no document is open" (I get the error in Italian).
I remember that all worked fine in the past (but maybe I'm wrong).
I tried the delay a lot in MainTemplate.dotm Document_Open before the first call of ActiveDocument, with no success.
If in the Access Frame of the result shown, I use a CommandButton instead of lauching my help, to launch via my code the Word Document, every thing is fine.
I really don't know how to catch the problem because the Word file is not open by my code but by an Access.
It seems the problem arise in the Access-Word interOp; some time if I try to debug the word document opened also the Access Mask will crash; if I just end the debug, the Access Mask will not freeze.
Sometime the problem arise even before the Word document is launched by the click, it seems also the correct visualization is not possible, also the full name of the document is not shown.
I know that I should be more specific, but I don't know where to look for.
Thanks, Lauro
I'm developing a simple database of Word documents in Access.
WORD
- Each document stored is based an a MainTemplate.dotm and several MyServiceTemplateXx.dotx with Building Blocks specific to different languages.
- The document template has various content controls and other objects.
- In the Document_New and Document_Open of MainTemplate.dotm, I run some checks to see if the document is well formed and doing some initializations.
ACCESS
- The documents are stored in a table (a field is OLE object, another Full Name of the document).
- In a form I can launch Word to create a new document.
- In another form I can run a criteria based research that will show the results in a third form
- In this last form the user can see the Word document in a BoundObjectFrame. Clicking on it, the document is opend in Word.
I didn't work on the project for several months. Now, back on it, I discovered a strange and not constant behaviour.
IF the file is launched from Word, everything is always fine.
IF the file is launched from Access clicking in the BoundObjectFrame, most of the time my checks are non passed because Word will not find an ActiveDocument.
Every call to the ActiveDocument, also in the first line of the Document_Open routine, will trow the error 4228 "The command is not available because the document is not open" or ".. no document is open" (I get the error in Italian).
I remember that all worked fine in the past (but maybe I'm wrong).
I tried the delay a lot in MainTemplate.dotm Document_Open before the first call of ActiveDocument, with no success.
If in the Access Frame of the result shown, I use a CommandButton instead of lauching my help, to launch via my code the Word Document, every thing is fine.
I really don't know how to catch the problem because the Word file is not open by my code but by an Access.
It seems the problem arise in the Access-Word interOp; some time if I try to debug the word document opened also the Access Mask will crash; if I just end the debug, the Access Mask will not freeze.
Sometime the problem arise even before the Word document is launched by the click, it seems also the correct visualization is not possible, also the full name of the document is not shown.
I know that I should be more specific, but I don't know where to look for.
Thanks, Lauro
Last edited: