Results 1 to 12 of 12
  1. #1
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160

    Printing Multiple Bills in a sngle command

    Hi Guys,

    I am working on a billing database.

    I am generating the bill and able to print it through print preview. Now I want user to to be able to search for the bill it wants to print through a query based on dates. I able to generate the desired list through query and the display in report format. Now I wan't to add a code inside the report that when ever the user clicks on any bill number it goes to a print command for that particular bill. Also want to add another option to report of check boxes, if user want's to print multiple bills, he can select check boxes and print all the desired bills in a single command.

    How can we achieve this.
    Thanks for your help.
    Regards

    Deepak Gupta

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    thanks will try and get back to you.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem, post back if you get stuck.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Dear pBaldy,

    I tried the code but with no success. I am unable to figure out few things. I would like to explain what I am doing:

    I have a query qryBill which is pulling all the data from the tables for the bill & query qryBillsBetweenDates which is finding all the bills between two given dates.
    I have a report rptPrintBill Which is based on qryBill and printing relevant bill information & report rptBillBetweenDates (this is the report from where I want user to click the bill# which it wants to print) based on qryBillsBetweenDates.
    I also have form frmPrintBill from where I am passing dates to qryBillsBetweenDates.

    Thanks for the detailed explanation about the technique, very help ful. I am able to under stand the command with my very-limited VBA knowledge.
    Now, I am unable to under stand from your tutorial that where should i pass the argument BillNumber so that required result is achieved. Should I pass the BillNumber to rptPrintBill or to query qryBill ( if query then how make query accept that BillNumber, like we make user inputs accepted from forms - if so then what to type in query).

    I tried to run the DoCmd with rptPrintBill - this resulted in a blank bill being opened.
    When I try to run the DoCmd with qryBill - this results in too many arguments being passed (error).

    Looking forward to your help and guidance.
    Thanks and Regards
    Deepak Gupta

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The code would open the report, not the query. I'm not sure why your code didn't work since you didn't show it. Can you attach the db here, or at least your attempt?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    I agree with you the code would open report not the query and it does open report but with all blanks. As the report it self is based on query and for query to run it needs the BillNumber to be passed from the report, where the code is suppose to run. Now how to pass the Selected BillNumber to the query, is the question I am stuck with. When I manually fill the bill number I have no issues in generating the bill or printing it.

    I will try an upload the DB for reference at the earliest possible. Still If you could suggest something without it it would be much easier for me.

    Thanks and Regards
    Deepak Gupta

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You still haven't posted the code that opens the report blank. Using this method, the query isn't filtered, the report is. If you want the query to filter, I'd use a textbox on a form and have the query criteria point there.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    This is how I have got it to work, now.

    Private Sub BillNumber_Click()
    DoCmd.OpenQuery "qryBill", acViewNormal
    DoCmd.OpenReport "PrintBill", , , "BillNumber = " & Me.BillNumber
    End Sub

    Only issue is it is opening the query ( need to stop that ). Secondly it directly prints, Bill Wan't to get it on Print Preview Screen. Also how to make sure that the print command is sent to a predetermined printer with fixed option Like (2 copies and Best quality with normal paper) ?????

    Will now try for Multi printing option and come back to you if any problem arises.

    Thanks and Regards
    Deepak Gupta

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You've told the query to open; you don't need that line. Look at the arguments for OpenReport, one of them will let you preview instead of print (which is the default). In page setup you can specify a printer instead of the default.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Thanks now working perfectly for single bill printing. Never knew that we can give different printers and page settings for different reports. Thanks.

    Now will try for multiple bill printing.

    Regards
    Deepak Gupta

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 01-23-2018, 01:13 PM
  2. Bills of material
    By dgberry in forum Database Design
    Replies: 16
    Last Post: 04-14-2015, 01:21 PM
  3. Replies: 1
    Last Post: 09-26-2011, 03:33 PM
  4. Printing multiple reports with one command
    By AKQTS in forum Reports
    Replies: 2
    Last Post: 09-24-2010, 09:32 AM
  5. Bills of Materials / Inventory
    By CRM001 in forum Database Design
    Replies: 4
    Last Post: 05-20-2010, 01:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums