Results 1 to 12 of 12

Thread: Report

  1. #1
    Join Date
    Oct 2010
    Posts
    175

    Unanswered: Report

    I need to create a report, and I need some help.

    When my users are in a participant's information form, I want to add a button that opens a report that they can print just that individual's information.

    When I try to create a report, I'm getting information for all participants. So I guess my question is how do I change my report design to print just that individual's information?

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    One way is this technique, with OpenReport:

    Open a second form to the record
    Paul

  3. #3
    Join Date
    May 2010
    Posts
    601
    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

  4. #4
    Join Date
    Oct 2010
    Posts
    175
    I tried to do the "How to Print a Single Record from a Form in a Report", but being as unfamiliar with VBA coding as I am, I'm getting an error message.

  5. #5
    Join Date
    May 2010
    Posts
    601
    It would really help to know the exact error message.

    Please post your VBA code.
    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

  6. #6
    Join Date
    Oct 2010
    Posts
    175
    Private Sub cmdPrintRecord_Click()
    Dim strReportName As String
    Dim strCriteria As String

    strReportName = "rptPrintRecord"
    strCriteria = "[Individual ID]='" & Me![Individual ID] & "'"
    DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

    End Sub


    THE ERROR MESSAGE I'M GETTING IS AS FOLLOWS:
    RUNTIME ERROR 3464
    DATA TYPE MISMATCH IN CRITERIA EXPRESSION

  7. #7
    Join Date
    May 2010
    Posts
    601
    What is the data type for [Individual ID]?


    If numeric (like an autonumber or long) then try:

    Code:
    Private Sub cmdPrintRecord_Click()
    Dim strReportName As String
    Dim strCriteria As String
    
    strReportName = "rptPrintRecord"
    strCriteria = "[Individual ID]= " & Me![Individual ID]
    DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
    
    End Sub
    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

  8. #8
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Which is why I don't link to the MS site. They don't give the different syntax requirements.
    Paul

  9. #9
    Join Date
    May 2010
    Posts
    601

    Thumbs up

    Quote Originally Posted by pbaldy View Post
    Which is why I don't link to the MS site. They don't give the different syntax requirements.
    Paul,
    That makes a lot of sense to me.
    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

  10. #10
    Join Date
    Oct 2010
    Posts
    175
    It worked! Thanks so much!

    The only thing now I can't figure out with it is how to get program information onto the report as it is in my form. The information comes from a subform. Any thoughts?
    Last edited by akanick; 11-22-10 at 15:52.

  11. #11
    Join Date
    May 2010
    Posts
    601
    You're welcome.

    When I have a form that has sub forms I generally design a report in the same way. I use a sub report to print the data that displays in the sub form.

    I would use a sub report on a report to show related data in anbother table. Just like you use a sub form on forms to do the same thing.
    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

  12. #12
    Join Date
    May 2010
    Posts
    601
    When priting a report for the data on a form, it is a good idea to be sure that the data is saved to the table. Otherwise the report will not see the changes.

    Example:

    Code:
    Private Sub cmdPrintRecord_Click()
    Dim strReportName As String
    Dim strCriteria As String
    
    ' save any changes in the form to the table
    If Me.Dirty = True  Then Me.Dirty = False
    
    
    
    strReportName = "rptPrintRecord"
    strCriteria = "[Individual ID]= " & Me![Individual ID]
    DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
    
    End Sub
    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
  •