Version Difficulty in VB?

G

Guest

Hello,

I asked earlier for assistance in creating a Word document that I had more
control over in exporting Access records to. Alex Ivanov provided valuable
assistance, and an example: http://www.aleksoft.net/samples/Access_Word.zip

This example uses a module with a line of code that reads:
Set doc = .Documents.Add(Left(CurrentDb.Name, Len(CurrentDb.Name) - 8) &
"report.dot")

The example dB was created in an earlier version of Access than I have
(2003), and works beautifully. However, if I convert the dB to 2003 (which
allows me to edit it), the module creates an error when it is executed:
Run-timer error 5151, Word was unable to read this document. It may be
corrupt...

Any thoughts? Much appreciated.
Seth
 
A

Alex Ivanov

Already answered in original thread.
If len(currentdb.name)<>8 it will not resolve the path properly.
try set doc=.documents.add("your\path\to\report.dot")
 

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