Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Posts
    41

    Unanswered: Print Multiple reports from Multiple Records

    I have a table that has 97 records in it and I need to print out 97 seperate reports. I found some code that loops through the process but for some reason the report in access is creating one master report with all the records present. Is there a way to tell the report to only use the one record on the report.

    Any ideas are welcome and greatly appreicated.

    Thanks,
    Jeff

    VB Code:
    Function Reports()
    'Table Name: tblMadeTable
    'field Name: IndividualID
    'Report Name: rptMonthlyInd

    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim strWhere As String
    Set db = CurrentDb
    Set rs = db.OpenRecordset("HeaderInfo_report")
    With rs
    .MoveFirst
    Do Until .EOF
    strWhere = "HeaderID = " & !HeaderID
    DoCmd.OpenReport "Report_HeaderInfo", acNormal, , strWhere
    .MoveNext
    Loop
    .Close
    End With
    Set rs = Nothing
    Set db = Nothing

    End Function

  2. #2
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by lynchjl7748 View Post
    I have a table that has 97 records in it and I need to print out 97 seperate reports. I found some code that loops through the process but for some reason the report in access is creating one master report with all the records present. Is there a way to tell the report to only use the one record on the report.

    Any ideas are welcome and greatly appreicated.

    Thanks,
    Jeff

    VB Code:
    Function Reports()
    'Table Name: tblMadeTable
    'field Name: IndividualID
    'Report Name: rptMonthlyInd

    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim strWhere As String
    Set db = CurrentDb
    Set rs = db.OpenRecordset("HeaderInfo_report")
    With rs
    .MoveFirst
    Do Until .EOF
    strWhere = "HeaderID = " & !HeaderID
    DoCmd.OpenReport "Report_HeaderInfo", acNormal, , strWhere
    .MoveNext
    Loop
    .Close
    End With
    Set rs = Nothing
    Set db = Nothing

    End Function
    Jeff,

    What is the data type for [HeaderID]?

    If is is not numeric try:

    strWhere = "HeaderID = """ & !HeaderID & """"


    or

    strWhere = "HeaderID = " & Chr(34) & !HeaderID & Chr(34)
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •