Results 1 to 9 of 9

Thread: [RESOLVED] Writing to a "Sequential Access File" & Printing a Report

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    19

    Resolved [RESOLVED] Writing to a "Sequential Access File" & Printing a Report

    Can someone please take a look at my code and get me back on track here is what I'm trying to accomplish.

    I want an application that will allow the user to enter the inventory number, quantity, and price of each item in inventory. The application should allow the user to record this information in a sequential access file named la3.dat

    In addition, the application should allow the user to print a report showing the inventory number, quantity, and price of each inventory item, as well as the average price.

    Inventory Number Quantity Item Price
    ABC12 100 10.50
    XYZ35 50 15.99
    KLK25 150 20.00

    Here is what I have thus far for the printing the report:
    VB Code:
    1. Private Sub cmdPrint_Click()
    2.     Dim strIN As String, intQty As Integer, intIP As Integer, intAvg As Integer
    3.     Dim strFont As String, sngSize As Single
    4.     Dim strPS1 As String * 5, strPS2 As String * 3, strPS3 As String * 5
    5.        
    6.    
    7.     strFont = Printer.Font          'save current printer settings
    8.     sngSize = Printer.FontSize
    9.     Printer.Font = "courier new"    'change printer settings
    10.     Printer.FontSize = 10           'print title and headings
    11.     Printer.Print Tab(30); "Boggs Inc.Inventory Report"
    12.     Printer.Print
    13.     Printer.Print Tab(5); "Inventory Number"; Tab(25); "Quatity"; Tab(37); "Item Price"
    14. End Sub

    Please Help
    Last edited by Stormy_VB6; Nov 28th, 2005 at 07:22 PM. Reason: The Title is misleading....

  2. #2
    Fanatic Member paralinx's Avatar
    Join Date
    Jun 2005
    Location
    Michigan
    Posts
    987

    Re: Printing a Report

    Does this not work?


    You need to have this

    VB Code:
    1. Private Sub cmdPrint_Click()
    2.     Dim strIN As String, intQty As Integer, intIP As Integer, intAvg As Integer
    3.     Dim strFont As String, sngSize As Single
    4.     Dim strPS1 As String * 5, strPS2 As String * 3, strPS3 As String * 5
    5.        
    6.    
    7.     strFont = Printer.Font          'save current printer settings
    8.     sngSize = Printer.FontSize
    9.     Printer.Font = "courier new"    'change printer settings
    10.     Printer.FontSize = 10           'print title and headings
    11.     Printer.Print Tab(30); "Boggs Inc.Inventory Report"
    12.     Printer.Print
    13.     Printer.Print Tab(5); "Inventory Number"; Tab(25); "Quatity"; Tab(37); "Item Price"
    14.     Printer.Enddoc
    15. End Sub

  3. #3
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Printing a Report

    I want an application that will allow the user to enter the inventory number, quantity, and price of each item in inventory.
    You could use a list or a Msflexgrid to show the Items to the user.
    Then he can add, modify or delete items.
    For that you could simply use 4 textboxes, and 3 buttons(add, modify, delete)

    The application should allow the user to record this information in a sequential access file named la3.dat
    Having your list or flexgrid with the items, the user could select "SAVE" and the entire thing will be saved to file.

    In addition, the application should allow the user to print a report showing the inventory number, quantity, and price of each inventory item, as well as the average price.
    A Print button then. (or Menu, if you like) that would print the whole list,
    you should add at the end:
    VB Code:
    1. Printer.Endoc

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    19

    Data Not Showing

    The report prints, but contains does not contain the Inventory information

  5. #5
    Fanatic Member paralinx's Avatar
    Join Date
    Jun 2005
    Location
    Michigan
    Posts
    987

    Re: Printing a Report

    I just added the Printer.EndDoc like jcis mentioned

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    19

    Re: Printing a Report

    Printing the Report is now working, however it is not displaying the information that I have "Saved" / Collected. Please take a look at the attached.

  7. #7
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Printing a Report

    Quote Originally Posted by Stormy_VB6
    Printing the Report is now working, however it is not displaying the information that I have "Saved" / Collected. Please take a look at the attached.
    Attached where?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    19

    Re: Printing a Report

    Sorry about that....here is the attachment, I'm not sure if I'm headed down the right path.
    Attached Files Attached Files

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    19

    Re: Writing to a "Sequential Access File" & Printing a Report

    Someone...please take a look

Posting Permissions

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



Click Here to Expand Forum to Full Width