(Msg. 9) Posted: Fri Nov 07, 2008 8:40 am
Post subject: Re: Word Merge Data From MS Access Options Fields [Login to view extended thread Info.] Archived from groups: microsoft>public>word>mailmerge>fields (more info?)
Thanks for your reply. I think I'm getting closer to the solution.
I'm thinking of doing this in VBA so that I can use this in similar
forms for other agencies. Unfortunately these agencies woun't adopt a
uniform form. They all have 90% of the same items, but the rest is
their own ideas. So for these12 items, I'm thinking of making VBA
function driven by an event like "msoOpenDocument" or "ActiveDocument"
or "CustomDocumentProperties" or "DocumentChange". Since I'm more
familiar with MS Access than MS Word, I don't know which would be a
good trigger event to activate the function. Also I'm think that on
the form I'll use fields with no properties other than an unique name
and use VBA to set the properties and formulas into each of the fields
using those unique names (aka ID). So let me focus in on a question
that you may be able to answer.
1. How can I set the properties of each field (i.e. make it a merge
field) and include the necessary formula that would be otherwise
placed inside the field directly on the form, but now all by using
VBA? I know that there must be a way to identify each individual
field by referencing its unique name (i.e. option1, option2, etc.)
Something like: Fields.Add wrdApplication.Selection.Range, "option1"
2. Which event would you recommend to trigger the function to set the
properties?
(Msg. 10) Posted: Sat Nov 08, 2008 3:06 am
Post subject: Re: Word Merge Data From MS Access Options Fields [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
I would start with a Word Template in which I would use Document Variable
{ DOCVARIABLE varName } fields where you want the information from the
Access database to appear. Then in your VBA Code, you would set the value
of the variables [varname] to the value from Access using
Dim NewDoc as Document
Set NewDoc = Documents.Add("templatename")
With NewDoc
.Variables("varname").Value = somethingformAccess
'etc
.Range.Fields.Update
End With
If you are creating multiple documents, you would put this inside a
For....Next loop that iterated through the records in the database, creating
a new document for each one.
I am not sure what you mean by thinking that you are getting closer to a
solution. Whichever way, you still have the issue of needing to display
something that looks like a series of radio buttons.
You should also consider whether the whole thing can be done as a report in
Access. In a number of applications, I use Access reports to produce
documents that to look at them are indistinguishable from documents produced
by Word.
--
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
"PC User" <pc_user DeleteThis @softhome.net> wrote in message
news:a45b7065-6da3-435a-be59-60800c88a10f@f40g2000pri.googlegroups.com...
> Thanks for your reply. I think I'm getting closer to the solution.
> I'm thinking of doing this in VBA so that I can use this in similar
> forms for other agencies. Unfortunately these agencies woun't adopt a
> uniform form. They all have 90% of the same items, but the rest is
> their own ideas. So for these12 items, I'm thinking of making VBA
> function driven by an event like "msoOpenDocument" or "ActiveDocument"
> or "CustomDocumentProperties" or "DocumentChange". Since I'm more
> familiar with MS Access than MS Word, I don't know which would be a
> good trigger event to activate the function. Also I'm think that on
> the form I'll use fields with no properties other than an unique name
> and use VBA to set the properties and formulas into each of the fields
> using those unique names (aka ID). So let me focus in on a question
> that you may be able to answer.
>
> 1. How can I set the properties of each field (i.e. make it a merge
> field) and include the necessary formula that would be otherwise
> placed inside the field directly on the form, but now all by using
> VBA? I know that there must be a way to identify each individual
> field by referencing its unique name (i.e. option1, option2, etc.)
> Something like: Fields.Add wrdApplication.Selection.Range, "option1"
>
> 2. Which event would you recommend to trigger the function to set the
> properties?
>
> Thanks,
> PC
>
>
>
>
(Msg. 11) Posted: Sun Nov 09, 2008 6:12 am
Post subject: Re: Word Merge Data From MS Access Options Fields [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Yes, I'm quite aware of making these same reports in MS Access and I
have done that. However, my program manager wants these documents
done in MS Word, but because of the massive amounts of data, I have
already started making the reports in MS Access. Now to give him an
archived set of reports in MS Word, I'm programming MS Word. I feel
that handling large amounts of data are always done better on a
database; however, I'm trying to do my project quickly by using a
database and accommodate my manager by putting the reports in MS
Word.
It seems that asking a question is not enough on a forum, but I have
to justify my request. These things are a little personal, but if
this is what is needed to get an answer I guess I have to say it. I'm
sure its always interesting to get the background of some of the
unusual questions that people post. If its ok with you, I'd like to
stay on my posted question.
I'll use your code concept in a MS Word module to loop through all the
fields on the document to set their names and properties triggered by
using the msoOpenDocument event.
(Msg. 12) Posted: Mon Nov 10, 2008 3:05 am
Post subject: Re: Word Merge Data From MS Access Options Fields [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
No, it is not always necessary to justify a request, but having created a
number of very complex reports in Access, I do feel justified in suggesting
that to use an Access report is sometimes better than trying to create
something in Word.
Sometimes it is the manager who needs educating.
--
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
"PC User" <pc_user DeleteThis @softhome.net> wrote in message
news:7b84cce9-545e-4948-8a87-ee68c7aaec9b@n33g2000pri.googlegroups.com...
> Yes, I'm quite aware of making these same reports in MS Access and I
> have done that. However, my program manager wants these documents
> done in MS Word, but because of the massive amounts of data, I have
> already started making the reports in MS Access. Now to give him an
> archived set of reports in MS Word, I'm programming MS Word. I feel
> that handling large amounts of data are always done better on a
> database; however, I'm trying to do my project quickly by using a
> database and accommodate my manager by putting the reports in MS
> Word.
>
> It seems that asking a question is not enough on a forum, but I have
> to justify my request. These things are a little personal, but if
> this is what is needed to get an answer I guess I have to say it. I'm
> sure its always interesting to get the background of some of the
> unusual questions that people post. If its ok with you, I'd like to
> stay on my posted question.
>
> I'll use your code concept in a MS Word module to loop through all the
> fields on the document to set their names and properties triggered by
> using the msoOpenDocument event.
>
> Thanks,
> PC
All times are: Eastern Time (US & Canada) (change) Goto page Previous1, 2
Page 2 of 2
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum