Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

From Access to Word

Status
Not open for further replies.

orna

Programmer
Apr 2, 2002
314
IL
Hi
I'm transfering a record from Access to Word with this code:

Set objword = New Word.Application
Do Until rst.EOF
With objword
.Visible = True
.Documents.Add Template:=("\\Server\a.dot")
.Selection.GoTo Name:=("CustName")
.Selection.TypeText Text:=rst![CUST_NAME]
.Selection.GoTo Name:=("OpenDate")
.Selection.TypeText Text:=rst![OpenDate]
.....
End With
Loop

How do i transfer more then one recode.
for instance: an order with lines

TIA

 
I wonder if nobody knows how to do it or is my explanation not clear enough???
 
I think your explanation is not clear enough. Try including some sample data and how you would like it displayed.
 
OK
The Word document shuld look like this:

Order Numb: 321321
Customer: Lincoln jack

Product quantity Amount
------- -------- ------
321325 17 1700$
365216 1 200$
555555 2 700$

for the order num and customer i insert boomarks in a word template but since the quantity of lines is changing i don't
know how to deal with.
 
why don't you do a mail merge to achieve this?

Do simple export as a spreadsheet from the DB query and use it as the datasource.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
or that of course, but if they want to have a stationery template that is held outside the database that the secretary/admin can amend without having to touch the DB a word mailmerge template is much more versatile.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
But so much more difficult with sub-tables, as data needs to be duplicated to each sub-table line, don't you think?
 
depends on how you build the query, you can create mergefields on the fly in the query and use iif commands to do logic also.

I use this method all the time to great effect. I guess it's down to preference and needs.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Thank you Remou & 1DMF
I build it as an Access report but i want to e-mail it
and Access dosn't have a good answer to this.
 
Yes it does. You can use SendObject. You can also look at the FAQs where there are several posts on emailing.
 
you can plug into MS Outlook , though there are security issues to concider.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top