Regina Whipp

The difficult I do immediately, the impossible takes a little bit longer.

Modules

Loop thru records and OutputTo seperate .RTF documents

'Posted by ADezii 5.23.2009 on bytes.com

'Modified by Gina Whipp 11.4.2009 to OutputTo Multiple Files

'Tested in Access 2003 with a Combo Box

 

Dim intCounter As Integer

Dim cboCode As ComboBox

 

Set cboCode = Me![YourControl]

 

'If Your Data Type is Numeric

For intCounter = 0 To cboCode.ListCount - 1

  DoCmd.OpenReport "YourReport", acViewPreview, , _

                   "[YourFieldControlSource] = " & cboCode.ItemData(intCounter)

  DoEvents

  DoCmd.OutputTo acReport, "YourReport", acFormatRTF, "DriveLetter:\FolderName\FileName" & Format(intCounter, "000") & ".rtf"

  DoCmd.Close acReport, "YourReport"

Next

 

 

'If Your Data Type is a String

For intCounter = 0 To cboCode.ListCount - 1

  DoCmd.OpenReport "YourReport", acViewPreview, , _

                   "[YourFieldControlSource] = '" & cboCode.ItemData(intCounter) & "'"

  DoEvents

  DoCmd.OutputTo acReport, "YourReport", acFormatRTF, "DriveLetter:\FolderName\FileName" & Format(intCounter, "000") & ".rtf"

  DoCmd.Close acReport, "YourReport"

Next