Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / November 2005

Tip: Looking for answers? Try searching our database.

Using access data to fill-in pre-printed report forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
S.Hanagan - 27 Nov 2005 12:11 GMT
Aside from using the cumbersome mail merge, is there a decent way to take
access data and use it to fill-in a printable form?  By "form" I mean like a
tax return, not an access "form."
Doug Robbins - Word MVP - 27 Nov 2005 12:29 GMT
There are various ways of doing this.  For one, see the article "Access a
database and insert into a Word document the data that you find there" at:

http://www.word.mvps.org/FAQs/InterDev/GetDataFromDB.htm

The following procedure in the Initialize event of a UserForm in Word can be
used to load a list box on that form with the records from a table in Access
so that the user can select the record that they want and then have the data
from that record inserted into the document that is created when a new
document is created based on the template in which the userform is located.

Private Sub UserForm_Initialize()
   Dim db As DAO.Database
   Dim rs As DAO.Recordset
   Dim NoOfRecords As Long
   ' Open the database
   Set db = OpenDatabase("D:\Access\ResidencesXP.mdb")
   ' Retrieve the recordset
   Set rs = db.OpenRecordset("SELECT * FROM Owners")
   ' Determine the number of retrieved records
   With rs
        .MoveLast
        NoOfRecords = .RecordCount
        .MoveFirst
   End With
   ' Set the number of Columns = number of Fields in recordset
   ListBox1.ColumnCount = rs.Fields.Count
   ' Load the ListBox with the retrieved records
   ListBox1.Column = rs.GetRows(NoOfRecords)
   ' Cleanup
   rs.Close
   db.Close
   Set rs = Nothing
   Set db = Nothing
End Sub

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Aside from using the cumbersome mail merge, is there a decent way to take
> access data and use it to fill-in a printable form?  By "form" I mean like
> a
> tax return, not an access "form."
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.