• Printing selected records from a form

    Author
    Topic
    #355143

    I have a form on which there are a few command buttons, one of which prints a record. The problem I have is that I would like to limit the number of records printed to ones that the user selects using a Yes/No checkbox. How do I do this? The code I have:

    stDocName = “rptSingle_record”
    strReportString = Me.frmEditJournalNames.Controls(“select_for_print”) & ” = Yes”
    DoCmd.OpenReport stDocName, acPreview, , strReportString

    prints all records.

    I know this is something that should be simple ….

    kiwi44

    Viewing 0 reply threads
    Author
    Replies
    • #523319

      I have just run across the same issue in one of my applications. The solution I used was to add a Yes/NO field to the table(s) that would be the source of the report. When the user clicks the button to print the report, a separate form opens with an abbreviated part of the data (just the “LastName, FirstName” in my case) and the Yes/No Checkbox. I have buttons for Check All/Uncheck All on the form as well – they just run SQL to update the entire field to Yes or No. The report is based on a query of the same data as the first form, except the criteria is added to filter where the Yes/No field = Yes.

      I hope this isn’t too confusing. Let me know if you need an example and I’ll be glad to post a sample of the file.

      HTH thumbup

      • #523321

        Thanks Mark – good to know that someone else has similar issues!

        I had worked out the subform/checkbox part (only issue will be if two people are wanting to select items at the same time on a single copy of the database on the network). However, the only way I could get the button to work as intended was to create a query, then use that as the filter. It works, so I am OK with it, and my staff are delighted. However, if there is a more ‘elegant’ solution, I would be happy to hear!

        kiwi44

    Viewing 0 reply threads
    Reply To: Printing selected records from a form

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: