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 / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Importing access data to form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
writetodaveo@gmail.com - 19 May 2006 11:12 GMT
Hi there,

I have an access query that returns a lost of names given certain
criteria. The list of names changes as the criteria is changed. I would
like to export this list to a Word form table, with a checkbox next to
each name entry. The problem I think I will have is that the length of
the list of names will change each time, and I would need the word
document to add/remove rows and checkboxes in the table, depending on
the list length.

The idea is, this word form can be emailed to someone to complete and
then sent back to me.

Is this possible?

Thanks - David
Cindy M  -WordMVP- - 21 May 2006 08:26 GMT
> I have an access query that returns a lost of names given certain
> criteria. The list of names changes as the criteria is changed. I would
[quoted text clipped - 8 lines]
>  
> Is this possible?

Yes, it should be possible. The most efficient way to create a Word table
is to concatenate the information into a delimited string (tab-delimited,
for example). Dump this into a Word range, then use the ConvertToTable
method. This is all explained in the following article

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_wd20
03_ta/html/OfficeWordAutomatingTablesData.asp

In this case, you should place an "empty" tab at the beginning of each
"row", so that an empty column is generated. You can then loop through
the cells in this first column and insert a checkbox. I recommend you use
a checkbox from the FORMS toolbar, as this won't activate macro security
on the recipient's machine. After you've completed the document, you
should protect it as a form so that the checkboxes work.

Record inserting a checkbox form field and protecting the document to get
the basic syntax. Here's a sample to get you going:
   Dim rw as Word.Row
   Dim rng as Word.Range

   For each rw in oTbl.Rows
       Set rng = rw.Cell(1).Range
       rng.Collapse
       ActiveDocument.FormFields.Add( _
         rng, wdFieldFormCheckBox)
   Next

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Rate this thread:






 
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.