Filling out a template in MS Word from an Access database (1 Viewer)

kmsmith

New member
Local time
Today, 00:13
Joined
Sep 19, 2017
Messages
8
Hi everyone,

I am trying to fill out a pre-existing template in Microsoft word with information from my access DB. In it's essence this problem is quite straightforward, and I came up with a bit of code to carry it out (see below).

My current hurdle: I have a datasheet subform with a list of shareholders on it for a given record (this list can be anywhere from 1-30), and I would like each shareholder name to appear in my word template separated by the word "And".

To further complicate matters, my datasheet subform has a checkbox column, and I only want to pull shareholder names that the user has placed a check mark beside. See below for the code I have been using insofar--I could really use some tips on how to adjust it for my current problem.

Thanks a million to anyone who takes the time to respond!

Set doc = appWord.Documents.Open(path, , True)
'Filling out fields with data from the current form
With doc

.FormFields("Name").Result = Nz(Forms![ERP Master Form]!Name)
.FormFields("fldDate").Result = Format(Date, "yyyy-mm-dd")
.FormFields("fldLicensee").Result = Nz(Forms![ERP Master Form]!Licensee)

.Form
.Visible = True
.Activate
End With
Set doc = appWord.Documents.Open(path, , True)
Set doc = Nothing
Set appWord = Nothing
Exit Sub
:banghead:
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 07:13
Joined
Jul 9, 2003
Messages
16,245

kmsmith

New member
Local time
Today, 00:13
Joined
Sep 19, 2017
Messages
8
Thanks a ton!!! I think I can just use the approach from the first video and query records that are checked! I'll play around with it.
 

Users who are viewing this thread

Top Bottom