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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vba for word with sql help

Status
Not open for further replies.

vbasqlhelp

IS-IT--Management
Jun 3, 2009
1
US
Hi, I need help with accessing data from an SQL server and putting it into word. Basically, I need to go through the records and print them to a word document. However, there are a varying amount of records, so there must be a loop of some sort that executes based on how many entries there are for that specific field.

Thanks!
 
The way you asked for help leaves the answer pretty open. From Word I use a connection "Function" component in a module that returns an ADO recordset(s)

Once I retireve my data I place it in tables.

In my case I use a form that is called when the document opens (Or can be called from a Macro) to get some basic information and from there run my subs via a command click event.

What "Event" needs to happen to get the data and once you have it, how do you want to display it etc ?

 
From Word I use a connection "Function"" - of course -
ignore my comment about excel you don't need it for your task Word will do the trick as CaptainD suggests.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top