Those two words were meant for each other. :cheesy: Anyways, i got the final on Wednesday and it's due next Wednesday.

I have to design a program that takes information from a text document, displays that information, makes calculations based on that information, and then prints those calculations in a separate text document. The document LarryLemon.txt is the record of all cars sold at a used car lot. With each car sold the following variables were recorded in the document: VehiclePrice, LastName$, FirstName$, Phone, Address, City$, State$, ZIP, and Salesperson$.

I have written the following code so far:

'Ananda Bennett
'12/06/06
'Sales program

OPEN "c:\LarryLemon.txt" FOR INPUT AS #1

DO WHILE EOF(#1) <> -1
INPUT #1, VehiclePrice, LastName$, FirstName$, Phone, Address, City$, State$, ZIP, Salesperson$

PRINT "VehiclePrice  LastName  FirstName  Phone  Address  City  State  ZIP  Salesperson"
PRINT "................................................................................................"
PRINT VehiclePrice; "  " ;LastName$; "  " ;FirstName$; "  " ;Phone; "  " ;Address; "  " ;City$; "  " ;State$; "  " ;ZIP; "  " ;Salesperson$
PRINT "                                                                                                "

LOOP

CLOSE #1

The code above only displays the information in the LL.txt file. The three calculations that I need to make are totaling how many cars each sales person sold, the total of their sales, and the average cost of a car he or she sold. Along with the sales persons name, the other two calculations need to be sent to a file for each sales person.

In order to count the total of cars sold by each sales person I was going to use the following code:

'i will do this for each sales person 
IF Salesperson = Taylor THEN
LET count = count + 1

The following code will print the three calculations that I mentioned above:

LET totalcost = cost + cost
LET avgcost =(totalcost)/count
PRINT "                                                              Vehicles sold: ";count
PRINT "                                                              Total sales: ";totalcost
PRINT"                                                               Average sales: ";avgcost

Now the only thing left to do is print, along with the corresponding sales persons name, the total of their sales, and the average cost of a car he or she sold, in a text document. I pretty much have no idea how to do that. So, if anyone here could give me some insight into this it would be greatly appreciated.

Also, i have no idea if any of the code past the first snip-it works because my PC is in the shop. If someone would run them and let me know which ones work and which ones don't, that too would be greatly appreciated.

Thanks,

Ananda :twisted:

Hi,

I'am giving u the most simplest way of doing this.
Place 1 ListBox on the Form say lstSMan
Check Property, Sorted = False
Clear lstSMan.
Assuming U have Opened the File and u r in a loop.
u have populated the variable SalesPerson.
write this code inside the loop.

lstSMan.Clear
'Open file
'Do
lstSMan.Text = SalesPerson
If lstSMan.SelCount = 0 Then
    lstSMan.AddItem SalesPerson
    lstSMan.ItemData(lstSMan.NewIndex) = 0
    lstSMan.Selected(lstSMan.NewIndex) = True
End If
lstSMan.ItemData(lstSMan.ListIndex) =lstSMan.ItemData(lstSMan.ListIndex)  +1
 
'Write Loop Condition
'Do Any Other Coding here
 
So as per the above code, after the loop, lstSMan Consists of All the SalesPersons and their corresponding Counter is in their ItemData Property, use this code to print.
 
Dim i As Integer
For i = 0 To lstSMan.ListCount-1
    Debug.Print lstSMan.List(i) & "    " & lstSMan.ItemData(i)
Next

I hope it is clear. if u have problems, let me know.

Regards
Veena

QVeen72, you've been asked multiple times to use code tags. Is there a problem with understanding what they are? How to use them? Where to get the information? All this has been mentioned... Check the post at the top if the forum labled Please use BB Code and Inlinecode tags

QVeen72, you've been asked multiple times to use code tags. Is there a problem with understanding what they are? How to use them? Where to get the information? All this has been mentioned... Check the post at the top if the forum labled Please use BB Code and Inlinecode tags

Thank you for posting that. I'm new to programing so when I read QueenV's response I thought either there was something wrong with me or i just wasn't geek enough yet to understand it. :p

Thanks again,

Ananda :twisted: