Solved

how do I get this code to priiint

Posted on 2002-06-22
2
147 Views
Last Modified: 2010-08-05

Dim inv As String * 8
Dim ddate As String * 9
Dim amt As String * 7
Dim amt5 As String * 7
Dim deal As String * 15
Dim paid As String * 3

Open "C:\invoice\dollar.dat" For Input As #1
a = 0
B = 0
Do Until EOF(1)
Input #1, inv, ddate, amt, amt5, deal, paid
a = a + amt
B = B + amt5
Loop
Close #1
Form1.Text1.Text = Val(a)
Form1.TEXT2.Text = Val(B)


8888888888888888888888888888888888888888888888888888888

after I print the contents of this file, what code do I need to print the val of a & b at the end of the printout?

I am using vb 4.
thanks
0
Comment
Question by:hjaycox
2 Comments
 
LVL 18

Accepted Solution

by:
Crash2100 earned 50 total points
ID: 7101265
Something like this?



Dim inv As String * 8
Dim ddate As String * 9
Dim amt As String * 7
Dim amt5 As String * 7
Dim deal As String * 15
Dim paid As String * 3

Dim a as integer
dim B as integer

Open "C:\invoice\dollar.dat" For Input As #1
a = 0
B = 0

Do Until EOF(1)
     Input #1, inv, ddate, amt, amt5, deal, paid

     Printer.Print "***********"
     Printer.Print "Inv: "; trim(inv)
     Printer.Print "Ddate: "; trim(ddate)
     Printer.Print "Amt5: "; trim(amt5)
     Printer.Print "Deal: "; trim(deal)
     Printer.Print "paid: "; trim(paid)
     Printer.Print

     a = a + val(amt)
     B = B + val(amt5)
Loop

Close #1

Printer.Print
Printer.Print "**** Totals ****"
Printer.Print "Amt: "; str(a)
Printer.Print "Amt5: "; str (B)
0
 
LVL 4

Expert Comment

by:TomLaw1999
ID: 7101663
Printer.Print Text1
Printer.Print Text2
Printer.EndDoc
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question