Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Forms populating Word via bookmarks Formatting help

Status
Not open for further replies.

jchim32

MIS
Oct 25, 2002
16
0
0
US
Hola Access gurus,

I have been tasked with creating a proposal generator for our sales force and have run into some roadblocks. I have created a form that populates a word template using bookmarks. I have a subform that will have 9 combo boxes that I need to populate the word doc but I need some help with the formatting. Not all of the 9 items within the subform will always be selected. When these items populate the subform I need them to be bullet items. So, my question is: What VB code will allow the form to populate the Word doc and format it such that if 3 items are selected, only 3 bullet items appear. And likewise, if 5 items are selected, how do I dynamically set it up so that only those 5 items appear? Keep in mind that I am decent with Access but not a VB coder by nature.
 
J,

This is a sample I wrote another tipper.

start code
Private Sub cmdReport_Click()
Dim rs As DAO.Recordset, dr(12) As Date, dayt As Date, num1 As Long, num2 As Long, num3 As Long, num4 As Long
Dim lyn As String, filnam As String
Dim mm As Variant

mm = Array("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")


dr(0) = #7/1/2003#
dr(1) = #10/1/2003#
dr(3) = #4/1/2004#
dr(2) = #1/1/2004#
Set rs = Me.RecordsetClone
rs.MoveLast: rs.MoveFirst
num1 = num2 = num3 = num4 = 0
Do While Not rs.EOF
dayt = rs("DateDue")
Select Case dayt
Case Is >= dr(0), Is < dr(1)
num1 = num1 + 1
Case Is >= dr(1), Is < dr(2)
num2 = num2 + 1
Case Is >= dr(2), Is < dr(3)
num3 = num3 + 1
Case Is >= dr(3), Is < dr(4)
num4 = num4 + 1
End Select
rs.MoveNext

Loop
rs.Close
Set rs = Nothing
filnam = &quot;C:\WINDOWS\TEMP\RGEReport.txt&quot;
Open filnam For Output As #1
Print #1,: Print #1,: Print #1,
lyn = Space(20) & &quot;Special Report &quot;

Print #1, lyn
lyn = Space(55) & pretty(Int(Now()), 1)
Print #1, lyn
Print #1,: Print #1,: Print #1,
Print #1, mm(Month(dr(0))); &quot; thru &quot; & mm(Month(dr(1) - 1)), &quot;bunch of other stuff&quot;, num1
Print #1, mm(Month(dr(1))); &quot; thru &quot; & mm(Month(dr(2) - 1)), &quot;more other stuff&quot;, num2
Print #1, mm(Month(dr(2))); &quot; thru &quot; & mm(Month(dr(3) - 1)), &quot;still more other stuff&quot;, num3
Print #1, mm(Month(dr(3))); &quot; thru &quot; & mm(Month(dr(4) - 1)), &quot;last of other stuff&quot;, num4
Close #1

GetWord (filnam)
End Sub

end code

GetWORD just opens a function in the global module that opens WORD with the file &quot;RGEReport.txt&quot; This works very well for me. I have done the bookmark bit but my notes are back in summerland and I am in winterland till it gets warm back in summerland. This way is so time effective that I'd rather use it.

rollie@bwsys.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top