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 / February 2004

Tip: Looking for answers? Try searching our database.

Retrieving Data from forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
wphx - 19 Feb 2004 03:39 GMT
I have received a number of documents, which have fields embedded in the
form, and then protected.

I want to be able to extract the data entered into these forms.

I have done some Access programming to read the formfields collection,
however, some fields have been created with no field names, and they don't
appear in the collection. Is there some way of reaching that data using VBA?

Thanks if you can help.
Peter Jamieson - 19 Feb 2004 06:30 GMT
A simple experiment here suggests that

Sub ListFormFields()
Dim oFormField As Word.FormField
For Each oFormField In ActiveDocument.FormFields
 Debug.Print oFormField.Type, oFormField.Result
Next
End Sub

lists all the types and results, even when the field names are blank. This
is in Word 2000. So...
a. Are you using similar code?
b. which version of Word?

An alternative might be to programmatically set Tools|Options|Save|"Save
data only for forms" then save the form, then open the resulting .csv file
using VBA OPEN (or otherwise), read the data and save it in your database.

--
Peter Jamieson - Word MVP
Word MVP web site http://word.mvps.org/

> I have received a number of documents, which have fields embedded in the
> form, and then protected.
[quoted text clipped - 6 lines]
>
> Thanks if you can help.
wphx - 19 Feb 2004 14:01 GMT
I think I've found my way through this.

Using access, I had first tried using the formfield names to create the
access table fields - however, there were duplicates and errors.

second, I created a tranlastion table - one field containing the word field
name and the second containing a unique access field name (generated from
the word field name)

I then walked through the formfields() collection, and sequentially grabbed
the access field name from the translation table.

I was able then to create the table and write the data into the appropriate
fields.

I had tried renaming the field names in the source document programattically
but it got into a tangle with the duplicate field names.

Anyhow, your reply has borne up what I found out that if I just scan thru
the collection, I can bypass referencing the field by its name.

Thanks again

> A simple experiment here suggests that
>
[quoted text clipped - 29 lines]
> >
> > Thanks if you can help.
 
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.