Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Newtown, Pennsylvania, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printing selected records from a form

    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

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing selected records from a form

    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 <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  3. #3
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Newtown, Pennsylvania, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing selected records from a form

    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

Posting Permissions

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