19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

234 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

‘Print the details of the individual transactions.<br />

Do Until EOF(1)<br />

If lineNo >= 57 Then<br />

‘57 or more lines have been printed; start a new page<br />

Printer.NewPage<br />

lineNo = 1<br />

End If<br />

If lineNo = 1 Then<br />

‘Print the report header<br />

Printer.Print<br />

Printer.Print “Name: ”; nameOnChk; Tab(65); FormatDateTime(Now,<br />

vbLongDate)<br />

Printer.Print<br />

Printer.Print , “Starting balance: ”; FormatCurrency(balance)<br />

Printer.Print<br />

Printer.Print “Date”, “Transaction”; Tab(50); “Amount”;<br />

Printer.Print Tab(65); “Balance”<br />

Printer.Print “____”, “___________”; Tab(50); “______”;<br />

Printer.Print Tab(65); “_______”<br />

Printer.Print<br />

Printer.Print<br />

lineNo = 10<br />

End If<br />

Input #1, transType, toFrom, balance, ck, dp, amount, memo, theDate<br />

If transType = “Check” Then<br />

Printer.Print theDate, “Check #: ”; ck; Tab(50); amount;<br />

Printer.Print Tab(65); FormatCurrency(balance)<br />

Printer.Print , “Paid to: ”; toFrom<br />

Else ‘Transaction was a deposit<br />

Printer.Print theDate, “Deposit #: ”; dp; Tab(50); amount;<br />

Printer.Print Tab(65); FormatCurrency(balance)<br />

Printer.Print , “Source: ”; toFrom<br />

End If<br />

lineNo = lineNo + 2<br />

‘If there was a memo, then print it.<br />

If memo “” Then<br />

Printer.Print , “Memo: ”; memo<br />

lineNo = lineNo + 1<br />

End If<br />

Printer.Print<br />

lineNo = lineNo + 1<br />

Loop<br />

Close #1 ‘Close the file<br />

‘Print the ending balance<br />

Printer.Print<br />

Printer.Print , “Ending Balance: ”; FormatCurrency(balance)<br />

Printer.EndDoc ‘Send the output to the Printer<br />

frmCheckbook.Caption = temp ‘Restore the form caption<br />

txtToFrom.SetFocus ‘Set focus for the next entry<br />

End Sub<br />

Private Sub cmdQuit_Click()<br />

‘Exit the program<br />

End<br />

End Sub

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!