Albert WordCode Error

A

Andy

Albert;

Please be so kind to offer Your assistance once more.

Your Word Merge code worked perfectly. I created a template in Word
inserting the fields in a table to print to labels, (7 Col., 4 Rows).
The fields were inserted into columns 1,3,5,7, (remainder of columns were
used as spacers.)

Noticed that one of the field names was too long for the column and Word
auto adjusted the row height. Wasn't happy with that so added an "Alias" to
the Qry used for the Form's Record Source,
(Example in the qry added: Short: OriginalLongName).

When I tried to "Modify the Template" Word opened and the "Header Record
Delimiters" dialog box opened with it asking for Field delimiter, ((Tab))
and Record delimiter ((enter)). The preview below that showed the original
field names. (Note: Below the field names it did show the correct data.)
Clicked the OK button in the dialog box. Word opened but without any menus
or tool bars. Nothing was displayed in the document. Clicked X to close
Word. It asked if want to save "Document1.doc, clicked No.

When Word closed Access displayed the Micorsoft Visual Basic diag box
showing: Run-Time error 5922 Word was unable to open the data source.
Clicked Debug.

'MsgBox strSaveDir

WordDoc.MailMerge.OpenDataSource _
Name:=strSaveDir & TextMerge, _
ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="",
WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=0, _
Connection:="", SQLStatement:="", SQLStatement1:=""

Was highlighted in the WordCode module.
Note: 'MsgBox strSaveDir wasn't hightlighted included it so that You would
know where the error occurred.

After clicking on the "Reset" button couldn't return to the Database. The
form used to open the WordMerge was displayed but couldn't activate/use the
form or the database window.
Access didn't crash, was able to use the File menu to Exit Access.
After a few of the "non-crashes" discovered that if I clicked on the "Design
View" icon it would display "GuiWordTemplate :Form would display in design
view and could close it from there.

Tried adding a new template. Same errors. Same lock ups.

Believed that if the fields were re-named back to the original names it
would be able to edit the template or add a new one. Same errors. Same
lock ups.

Thought came to mind that perhaps the code in the "WordCode" module had been
modified. Copied and pasted it anew. Same errors. Same lock ups.

Deleted the C:\MyFolder\Word\Label.doc template. Same errors. Same lock
ups.

Opened the C:\MyFolder\Word\merge.888 in Word it showed the original field
names. At first Deleted all but one of the field names and data. Then
deleted everything in 888 and saved it. Same errors. Same lock ups.

Copied Your original merge.888 and finally deleted merge.888 and generated a
new one. Same errors. Same lock ups.

And before composing and posting this letter used Word to display
Header/Footers all were blank. Also tried using a new qry containing only
one of the original fields. Same errors. Same lock ups.

Albert; realize this post is lenghthy and whether You reply or not wanted to
inform You of this "Bug" and give You the details of what was already tried
to remove it. Your creation is crisp, clear and to the point. And as I
said before wish that Microsoft's help and knowledge bases were as easy.

Incidently the Code still works for all other qrys but not the original one.
And somewhere along the way also discovered that an alias in the qry used as
the Form's record source would not work, the alias had to be added to a
seperate qry and then that qry was used to feed the qry used as the record
source.

Thank You for Your Time.

Andy
 
A

Andy

Albert;

Found the answer as to why/how a "Confused" user or Access or Word is/are
able to cause code that is on the cutting edge to malfunction.

For one of the fields in the merge I had been using data that was imported
from a DBase 3 application that was typed in when the original user was on a
DOS based computer.

Through trial an error discovered that while in Word with merge.888 clicked
on "Get Data Source" icon. After selecting the Qry and clicking Query
Options a dialog box popped up stating:

"The SQL string associated with the mail merge data source is too complex
for Word to parse. Do you want to edit the SQL string directly?"
Clicked View SQL.

Didn't really see anything out of the ordinary. A "Gut feeling" told me to
change the record I was using for the test merge.

WOW; IT WORKED!!!

Deleted the data for that record. Typed the words in again. Fresh using my
computer. Tested the merge using the newly typed data and WOW; IT WORKED!!!

Somewhere in the text in the original record there must be some character
that Word can't interpret.

Albert Thank You.

Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top