Nearly all men can stand adversity, but if you want to test a man's character, give him power.
- Abraham Lincoln
News
Site News
Latest Comments
Affiliates
Proxies
Contribute!
Chat
Tutorials
Newest Articles
Most Popular
Highest Rated
Latest Comments
Code Samples
Newest Code
Most Popular
Highest Rated
Latest Comments
Blogs
Admins Blog
Newest Blogs
Most Popular
Highest Rated
Latest Comments
Forums
Latest Posts
Latest Topics
Memberlist
[login]
|
[Register]
Record Reports
by: bs0d
Description:
Computer Warehouse example will have item codes to the right in a list. One can select an item from the list and click File-- print selected to see all of that type from the file specified. YOU MUST SPECIFY A FILE IN THE CODE, and put this data inside specified at top of code sample. -See picture
See Full Size
Code:
'Create a file, and enter this data (one record per line): ' "BDX22",100 ' "ABC11",150 ' "BDX22",250 ' "CVA33",100 ' "ABC11",300 ' "BDX22",200 ' "ABC11",140 ' "BDX22",120 ' "CVA33",110 ' "ABC11",500 ' Remember to inser the path to your file in the 2 diff. locations in the code ' Option Explicit Dim strCode As String, intNumber As Integer, countNum As Integer Private Sub Form_Load() frmComputer.Top = (Screen.Height - frmComputer.Height) / 2 frmComputer.Left = (Screen.Width - frmComputer.Width) / 2 lstItem.AddItem "ABC11" lstItem.AddItem "CVA33" lstItem.AddItem "BDX22" lstItem.ListIndex = 0 End Sub Private Sub mnuAllRecords_Click() countNum = 0 Open "c:PATHTOYOURFILE.dat" For Input As #1 'opening file to read contents... Do While Not EOF(1) Input #1, strCode, intNumber 'read record, set variables Print strCode & intNumber countNum = countNum + 1 Loop Print "--End of Report--" Print "We printed: " & countNum & " records." Close #1 'all done, close file End Sub Private Sub mnuExit_Click() 'Unloads from Unload frmComputer End Sub Private Sub mnuRecordsByItem_Click() countNum = 0 Open "c:PATHTOYOURFILE.dat" For Input As #1 'opening file to read contents... Do While Not EOF(1) Input #1, strCode, intNumber 'read record, set variables If lstItem.Text = strCode Then Print strCode & intNumber countNum = countNum + 1 End If Loop Print "--End of Report--" Print "We printed: " & countNum & " records." Close #1 'close file End Sub
No Comments for this page.
You Must be
signed in
or a
member
to comment.
Code Stats
7,397
Views
0
Total Comments
0
Rating of 5 (
2
Votes)
Code Options
·
Login to Rate This Code
·
Login to Post a Comment
·
Read more by this author
Related
·
RGB Color Fader
·
Adder
·
Math Problems
·
Cut and Paste
·
Combo Box Colors
·
Flag Viewer
"AllSyntax.com" Copyright © 2002-2013; All rights lefted, all lefts righted.
Privacy Policy
|
Internet Rank