Outputting report to Word (1 Viewer)

Malcy

Registered User.
Local time
Today, 07:59
Joined
Mar 25, 2003
Messages
586
Apologies if this is not clear. I have set up report output to Word since formatting options are better but client now needs a new part added where instead of there simply being one entry to go to bookmark there is in effect a continuous report section which may have zero to perhaps 10 entries. The section will list activities flagged for the person.
If this were a report then no problem, simply use a sub report. However, how do I get this over into the Word document from the Access query that would in normal circumstances power the sub report?
If any clarification needed please shout and I will try and explain.
Thanks
 

jzwp22

Access Hobbyist
Local time
Today, 02:59
Joined
Mar 15, 2008
Messages
2,629
I had a similar issue. I ended up using VBA code to loop through the recordset of the records that would have been in the subreport and accumulated those records in a variable that I sent to a single bookmark in the Word template. Here is a snippet of the code that does that.

Code:
myrecset.Open mySQL
    
If myrecset.BOF And myrecset.EOF Then
    mem = ""
Else
    Do Until myrecset.EOF
        mem = mem + vbCrLf + myrecset(0).Value & "    " & myrecset(1).Value
        myrecset.MoveNext
    Loop
End If

myrecset.Close
 

Malcy

Registered User.
Local time
Today, 07:59
Joined
Mar 25, 2003
Messages
586
Thanks
That did the trick. A nice and logical approach which was very easy to implement. Appreciate it.
Best wishes
 

jzwp22

Access Hobbyist
Local time
Today, 02:59
Joined
Mar 15, 2008
Messages
2,629
I'm glad that worked for you. Good luck on your project.
 

Users who are viewing this thread

Top Bottom