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 to Word With Group Headings in Table

Status
Not open for further replies.

BeckyMc

Technical User
Jun 19, 2001
51
0
0
US
Don't know if this is a duplicate post or not as I didn't see my last attempt post.

I have the following code in an access database

Code:
 Set RST = DB.OpenRecordset(MySQL, dbOpenDynaset)
            If Not (RST.BOF) And Not (RST.EOF) Then
             RST.MoveLast
             MyCount = RST.RecordCount
             RST.MoveFirst
             MyTempCodegroup = RST!leftcodegroup
             
                            N = MyCount + 3
                            WordObj.ActiveDocument.Bookmarks("NeshapTable").Select
                            WordObj.ActiveDocument.Tables.Add Range:=WordObj.Selection.Range, numrows:=MyCount + 3, numcolumns:=2, defaulttablebehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixed
                            WordObj.ActiveDocument.Tables(7).Columns(1).SetWidth ColumnWidth:=100, RulerStyle:=wdAdjustNone
                            WordObj.ActiveDocument.Tables(7).Columns(2).SetWidth ColumnWidth:=430, RulerStyle:=wdAdjustNone

                                Do While Not RST.EOF

                                    WordObj.ActiveDocument.Tables(7).Cell(Row:=N, Column:=1).Range.InsertAfter Text:=RST!NeshapCodePart2
                                    WordObj.ActiveDocument.Tables(7).Cell(Row:=N, Column:=1).Range.ParagraphFormat.Alignment = wdAlignParagraphRight
                                    WordObj.ActiveDocument.Tables(7).Cell(Row:=N, Column:=2).Range.InsertAfter Text:=RST!NOVNRELanguage
                                    'WordObj.ActiveDocument.Tables(4).Cell(Row:=N, Column:=2).Range.ListFormat.RemoveNumbers NumberType:=wdNumberParagraph
                                    WordObj.ActiveDocument.Tables(7).Cell(Row:=N, Column:=2).Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
   
                                N = N - 1
                                RST.MoveNext
                                Loop
                                
                                    WordObj.ActiveDocument.Tables(7).Cell(Row:=N, Column:=1).Range.InsertAfter Text:=RST!leftcodegroup
                                    WordObj.ActiveDocument.Tables(7).Cell(Row:=N, Column:=1).Range.ParagraphFormat.Alignment = wdAlignParagraphRight
                                    N = N - 1

                             End If

=================================================

This is creating a Word table that looks like the following:



(k) Failure to conduct weekly perceptible leak inspections while machine is in operation [63.322(k)].
(i) Failure to drain all cartridge filters in their housing, or other sealed container, for a minimum of 24 hours, before removal from the dry cleaning facility [63.322(i)].

63.322
(a)(1)(ii) Failure to monitor on a weekly basis either the refrigeration system high pressure and low pressure readings during the drying phase to determine if they are in the range specified in the manufacturer’s operating instructions, or the condenser exit temperatures to ensure the perc vapor air stream flowing through the refrigerated condenser before the end of the drying cycle does not exceed 45 degrees Fahrenheit (7.2 degrees Celsius) [63.323(a)(1)(i) or (ii)].
(a)(1)(i) Failure to monitor on a weekly basis either the refrigeration system high pressure and low pressure readings during the drying phase to determine if they are in the range specified in the manufacturer’s operating instructions, or the condenser exit temperatures to ensure the perc vapor air stream flowing through the refrigerated condenser before the end of the drying cycle does not exceed 45 degrees Fahrenheit (7.2 degrees Celsius) [63.323(a)(1)(i) or (ii)].

63.323

========================================================

What I want is subgroup headings where 63.323 is at the start of the subgroup and 63.322 is at the start of its subgroup etc.

The name of the column the heading is in is called leftcodegroup.

The data is coming out the way that I want it but I can not get the codegroup heading in the right spot so that it's actually at teh beginning of it's specific group. I'm sure there's something I'm doing wrong with and probably with wdcollapse but I can't find it. Suggestions would be greatly appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top