Passing data betwen Word and Access 2003

K

Kev

Hello from Kalgoorlie Western Australia : )

I am working on a project to reduce manual input. I am sending word
survey forms to clients via mail merge to email. When the info comes
back from the clients, I need to place the data into a database and
save the form.

I need to address the following points and would really appreciate any
assistance:

1. What code do I use to locate a value in a text document.
The document wont be protected (Mail Merge - Word 03) so I cant use a
form field to identify the data. I plan to preface the database key
with ASSID: (ie: How do I search a doc for the word "ASSID:" and return
the value after it) . Should I be looking at another method?

2. Once I have the ASSID value(still in the WORD doc), how do I look
the value up in an Access Database table, and return other data for
that record to word? (ie: ASSID= 1234, I want to return the firstname
and surname field data to work so I can auto save the document with
that info).

Regards

Kevin
 
J

Jonathan West

Kev said:
Hello from Kalgoorlie Western Australia : )

I am working on a project to reduce manual input. I am sending word
survey forms to clients via mail merge to email. When the info comes
back from the clients, I need to place the data into a database and
save the form.

I need to address the following points and would really appreciate any
assistance:

1. What code do I use to locate a value in a text document.

That depends entirely on what level of structure you are able to give to the
document
The document wont be protected (Mail Merge - Word 03) so I cant use a
form field to identify the data. I plan to preface the database key
with ASSID: (ie: How do I search a doc for the word "ASSID:" and return
the value after it) . Should I be looking at another method?

That is one possible method. Another might be to make one or more tables in
the document and read the contents of different cells.
2. Once I have the ASSID value(still in the WORD doc), how do I look
the value up in an Access Database table, and return other data for
that record to word? (ie: ASSID= 1234, I want to return the firstname
and surname field data to work so I can auto save the document with
that info).

Set a reference to ADO or Access in your VBA project, connect to the
database, make the necessary query to return the recordset you need, build a
string for the filename from the results, and then use the SaveAs method
with your string in the FileName parameter to save the document with the new
name.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top