How to control printing in ms access form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SandeepJagdeva
    New Member
    • Jan 2007
    • 23

    How to control printing in ms access form

    I have a MS ACCESS Form that was designed for printing a Departmental Store’s bills. In this form I have a 6 column list box and some labels. The user adds items to this list box as per customer’s purchasing and then prints out this bill in 6x6 size paper. Command I use for printing is:-
    Code:
     stDocName = "Print_Bill"
        Set MyForm = Screen.ActiveForm
        DoCmd.SelectObject acForm, stDocName, True
        DoCmd.PrintOut
        DoCmd.SelectObject acForm, MyForm.Name, False
    Its working fine but my problem starts when the user adds more then 20 items in list box and print out the bill. Suppose the user adds 30 items in listbox and prints it out, on paper it prints only the first 20 items. Now I want that if items are more then 20 then ACCESS continues printing to the next page. I mean print a long bill in two or three pages as per items. Thanks in advance.
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by SandeepJagdeva
    I have a MS ACCESS Form that was deign for print a Departmental Store’s bills. In this form I have a 6 column list box and some labels. User add items to this list box as per customer’s purchasing and then print out this bill in 6x6 size paper. Command I use for printing is:-
    Code:
     stDocName = "Print_Bill"
        Set MyForm = Screen.ActiveForm
        DoCmd.SelectObject acForm, stDocName, True
        DoCmd.PrintOut
        DoCmd.SelectObject acForm, MyForm.Name, False
    Its working fine but my problem starts when user add more then 20 items in list box and print out the bill. Suppose user add 30 items in listbox and print it out, on paper it prints only first 20 items. Now I want that, if items are more then 20 then ACCESS continue printing to next page. I mean print a long bill in two or three pages as per items. Thanx in advance.
    I am not at all surprised that this does not work very well. The design strategy is not taking into consideration the expandability of the listbox.
    How are these items being added to the list?
    Is the listbox RowSourcetype property a table or is a value list?

    The aim should be to create a report based on the source for the list and print the report.

    Comment

    • SandeepJagdeva
      New Member
      • Jan 2007
      • 23

      #3
      Thanx for reply
      The 'Row Source Type' property is 'Value List'. I also have a combo box in this form this comb box's 'Row Source' is a table, in which we store all product's details with their 'Bar Code'. User scan 'Bar Code' of product with 'Bar Code Scaner'. In combo's Update event I load detail (with VBA), of product such as (Name,Price) etc. That how list box filled. Reports may be good option but for me my problem is still there, because Reports also show all listbox item in single page. ????

      Comment

      • Jim Doherty
        Recognized Expert Contributor
        • Aug 2007
        • 897

        #4
        Originally posted by SandeepJagdeva
        Thanx for reply
        The 'Row Source Type' property is 'Value List'. I also have a combo box in this form this comb box's 'Row Source' is a table, in which we store all product's details with their 'Bar Code'. User scan 'Bar Code' of product with 'Bar Code Scaner'. In combo's Update event I load detail (with VBA), of product such as (Name,Price) etc. That how list box filled. Reports may be good option but for me my problem is still there, because Reports also show all listbox item in single page. ????
        Yes any listbox would not automatically expand in a report. but in a Value list each item is separated by a semi colon.

        If you think about it, a compact version of this could be sent to a textbox on any report replacing the semi colon with a control line feed Vbcrlf or VbNewline constant in code thus providing a conventional list. The textbox would expand to accommodate the growth. It depends largely on how nice and compact you want to be on the report.

        Would it not be just as easy for you however to simply create a simple table to service the listbox and fill it with values? any report could reference a query that in turn references the table

        Comment

        • SandeepJagdeva
          New Member
          • Jan 2007
          • 23

          #5
          OK I try as u say. i tell u later. Hope it works
          Thanx

          Comment

          Working...