Word template merge from Access

  • Thread starter Thread starter Carol Grismore
  • Start date Start date
C

Carol Grismore

I'm trying to run a very simple TransferText to put data from an Access query
into a Word template. I get the message, "Cannot update. Database or object
is read only."

To the best of my ability to tell, nothing is read only. Any debug or
repair suggestions would be deeply appreciated.
 
Thank you for your suggestion!

I appreciate (and steal) others' code, and I'm sure this works just great.
Actually I think I already have it.

What I'm really trying to find out, though, is how to work the TransferText
command -- or that it doesn't work, and maybe why.

My bad for not making that clear in my first post.

Thanks again!
 
Thank you for your suggestion!

I appreciate (and steal) others' code, and I'm sure this works just great..  
Actually I think I already have it.

What I'm really trying to find out, though, is how to work the TransferText
command -- or that it doesn't work, and maybe why.

My bad for not making that clear in my first post.

Thanks again!

Not sure you can stuff data from Access directly to a Word template
using TransferText. I have stuffed data from Access to Word Bookmarks
using VBA, though. I would use Albert's solution unless you need to
transfer both data from the "many" side of a relationship and the
"one" side. The example from the Developers Handbook is an invoice.
They grab the "header" info from an invoice query (customer/Invoice
header) and then the line items from an invoice query. Then they
transfer the invoice header info using bookmarks.

post your code that's failing and highlight the line(s) where it fails.
 
Thank you for your suggestion!

I appreciate (and steal) others' code, and I'm sure this works just great..  
Actually I think I already have it.

What I'm really trying to find out, though, is how to work the TransferText
command -- or that it doesn't work, and maybe why.

My bad for not making that clear in my first post.

Thanks again!

If it makes you feel any better, if I try to do it they way you
describe, I get the exact same results. Weird!

It does work if I call the Mail Merge from within Word... so you could
automate Word to do it...

Sub RunMerge()
'
' RunMerge Macro
' MailMerge Macro attempt
'
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
End Sub

(that's the code that Word wrote for me.)

so you could declare an instance of Word and run the stuff from
there... open the document then continue... but why bother? Just
steal Albert's code, say "thanks Albert!" and on you go....
 
Back
Top