![word 2016 apa format with table of contents word 2016 apa format with table of contents](https://i.ytimg.com/vi/XUxNPFWYmOQ/maxresdefault.jpg)
TxtTOCPages has this control source: =GetProperty("TOCPages","") Here are the control sources of the txtCorrectedPageNo and txtCorrectedNumPages textboxes referenced in the above expression: =Val(.)-Val(.) =Val(.)-Val(.) ),"Page " & RomanNo(.))Īs is often the case on Access reports, I sometimes found it necessary to reference the value of a textbox, rather than the actual value that is the control source of the textbox. The page number expression is: =IIf((>.)=True,("Page " &. The expression that creates the page numbers references several invisible textboxes in the report footer (the yellow ones – that is my convention for invisible controls):
#WORD 2016 APA FORMAT WITH TABLE OF CONTENTS CODE#
See download code below for entire code including error handler.
![word 2016 apa format with table of contents word 2016 apa format with table of contents](https://www.thatsnotus.com/g/016-works-cited-essay-example-model-mla-paper-1920x2560.jpg)
MatchAllWordForms = False End With Set sel = appWord.Selection 'Retrieve page number from Word document intPageNumber = sel.Information(wdActiveEndPageNumber) Debug.Print "Customer ID " & strCustomerID _ & " page no.: " & CStr(intPageNumber) ! = intPageNumber. AddNew ! = strCustomerID 'Find Customer ID in Word document With. CheckSpellingAsYouType = False End With Do While Not rstSource.EOF strCustomerID = rstSource! With rstTOC. The procedure listed below does the work of saving the page numbers to the table used as the subreport’s record source: Public Function GetReportPages() On Error GoTo ErrorHandler 'Close existing RTF file if necessary strCurrentPath = & "\" strWordRTFFile = strCurrentPath & "Orders.rtf" Debug.Print "Word RTF file: " & strWordRTFFile On Error Resume Next Set doc = appWord.Documents(strWordRTFFile) If Not doc Is Nothing Then doc.Close savechanges:=wdDoNotSaveChanges End If On Error GoTo ErrorHandler 'Export Orders report to Word RTF file strReport = "rptOrders" DoCmd.OutputTo objecttype:=acOutputReport, _ objectname:=strReport, _ outputformat:=acFormatRTF, _ outputfile:=strWordRTFFile, _ autostart:=False Set doc = (strWordRTFFile) doc.Select 'Clear old TOC records strTOCTable = "tblTOCPageNos" strSQL = "DELETE * FROM " & strTOCTable DoCmd.SetWarnings False DoCmd.RunSQL strSQL 'Set up recordsets of customer codes to search for and table 'for storing Customer IDs and page numbers strQuery = "qr圜ustomerIDs" Set rstSource = CurrentDb.OpenRecordset(strQuery) Set rstTOC = CurrentDb.OpenRecordset(strTOCTable) appWord.Visible = True 'Turn off spelling and grammar checking With appWord.Options. Here is the first page of the report with a Table of Contents:Īnd here is the first page of the body of the report: Make a complex expression to display Roman numerals for the TOC page numbers, and Arabic numerals (starting with 1) for the regular page numbers.
![word 2016 apa format with table of contents word 2016 apa format with table of contents](https://perrla.zendesk.com/hc/article_attachments/360054151074/New_citation_features_2.gif)
Make a copy of rptOrders (rptOrdersWithTOC), and insert the subreport into the report header.Create a subreport (rsubTOC) whose record source is a query based on the table filled with current Customer ID and page number values.Using VBA code working with the RTF document and a recordset of CustomerIDs for customers who have orders, search for each CustomerID and get the number of the page it is on, and save the CustomerID and page number to a table.Here is a high-level description of how I did it: This is a long report, so it would be handy to have a table of contents listing the page for each Customer ID. The sample database for this article, Table of Contents Report (AA 236).accdb, has tables from the old Northwind sample database, and a standard stepped Orders report: Access reports don’t have such a feature, but I managed to create one using VBA code, custom database properties and some Word features. Word has a sophisticated Table of Contents feature that automatically creates a table of contents from designated headings in a document. By Helen Feddema Access versions: 2007-2013