User Parameter Query (Acess 2003) to Word Template

mick5003

New Member
Joined
Sep 8, 2010
Messages
8
Hi,

i am struggling with how to effectively 'export' the results of a query into a word template, where the query prompts the user for a query parameter.

I have set up the word template (.doc) and added in bookmarks to send the query data too but I cannot seem to get my head round how to send the data.

I apologise for the vagueness of this request but I am very new to Access (2003) and all my knowledge is from the 'for dummies' collection of books.

I just want to be able to press a button from my 'switchboard' which runs the query, opens the word document and then sends the data to the specified fields.

Can anyone help me please?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Wouldn't this be easier to do in Access as a Report. If you have more than 1 single record going into your word document you would get issues because of the amount of times it would need to run?

Code to open word could be:

You would need to reference the query

Function SendWord()
Dim wrd As Word.Application
With wrd
.Documents.Open "Enter the Path.doc"
.Selection.GoTo What:=wdGoToBookmark, Name:="gooday"
.Selection.TypeText Text:="Enter Text"
.Visible = True

End With

End Function

Also look at the following as a suggestion http://www.datapigtechnologies.com/AccessMain.htm

And look at
Create Form Letters Without Mail Merge
 
Upvote 0
Thanks Trevor, I will try this out.

I have ruled out using Access Reports as I need to add more information to the document once it has been created.

Also, in every instance, the query I am using will only ever return one record.

If you have any other thoughts please let me know.

Thanks again,

Mick
 
Upvote 0
Then pass the query results into a form and you can use the form object to pair up with the Bookmarks

So from the code I added you would amend that to the form control name that will give you the result you need.

Selection.GoTo What:=wdGoToBookmark, Name:="gooday"
.Selection.TypeText Text:=me.txtName.value

So from this example you would copy the selection.goto etc and change the bookmark name to the ones you are using and then the me.txtname.value to the controls on the form.
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,520
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top