Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2005, 10:41 AM
Authorized User
 
Join Date: Nov 2005
Posts: 16
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via Yahoo to tonyrosen
Default Read MSWord From Access?

I have a MSWord document that has a table with 8 rows and 2 columns. The first column lists questions (1 per row). The second column is answered either "yes" or "no".

Is there a way to retrieve that "yes" or "no" from MSAccess using VBA?
 
Old November 9th, 2005, 01:07 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Yep, there are two ways to do this.

1. You can parse each line of the word doc, and look for a phrase from each question, then split out the answer using an array. This involves a lot of trial and error.

2. You can turn the table into a Form, and then retrieve the form fields from Access. This is more direct and there is no trial and error.
   If you use this method, you need to apply data validation to your form so that the data being entered can be readily retrieved into Access.

The question is, which one do you want to do? Are you planning this system and can therefore do your own design? If so, use the form. Have you inherited a lot of data and need an ETL solution? If so, parse the text (you may want to turn all the doc files into text files to make this easier. You can write a quick file converter in VBA to do this for you when you open your database.)

HTH

mmcdonal
 
Old November 9th, 2005, 02:14 PM
Authorized User
 
Join Date: Nov 2005
Posts: 16
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via Yahoo to tonyrosen
Default

It's a brand spankin' new form, so option 2 looks like it'd work well ... now, i have to figure it out ...

Thanks!

 
Old November 9th, 2005, 02:46 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Search Word for "Create forms that users complete in Word" to get started. Also, invoke the database toolbar and see if there is anything that allows you to do data entry. You should be able to invoke the text fields etc you create in your form through the word object model, or send the data directly to the database if you save the file as html, and put in a submit button. Users should be able to open this in Word, fill out the form (protect the text sections) and then click submit. This could go to an intermediate table for approval before final submission. This is good for a local solution. Otherwise convert to txt and parse.

HTH

mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Why use VB.Net to read Access? AmyEL VB.NET 2002/2003 Basics 3 February 24th, 2005 12:12 PM
Read-Only Access phungleon Access 14 January 29th, 2004 03:04 PM
Browse Dialog for MSWord ddonnahoe Access VBA 1 January 22nd, 2004 04:30 PM
How to read/write Access Database jmmendes Access VBA 0 November 18th, 2003 01:26 PM
i would like convert msword to pdf pmwps Classic ASP Basics 2 September 6th, 2003 11:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.