Hello, i have been working on a VB Assignment which needs to be completed. However i have been experiencing some difficulties. I am not particularly experienced with VB, and so forgive me if these problems seem nooby..
Basically so far, i have a form where Data of a Customer and Car is stored in a Random Access File. This form is working fully correctly. I also have a stocklist form which is also working fully correctly, detailing Tyres name, ID , Quantity and Price. Anyhow the problem lies in a 3rd form. An Invoice. Im bring the data back from the Random Access Files ok, so it displays all data on my form. However the problem lies with calculating the price and discount. I have two problems, and i have tried all i can think of to get them working.
Private Sub cmdDisplayPrice_Click() Dim Product As Tyre Dim Company As Companies Dim Car As Cars Dim CompanyName As String Dim Stocklist As String Dim Discount As Currency Discount = lblDiscount.Caption CompanyName = lblCustomer.Caption Stocklist = "C:\Documents and Settings\Jack\My Documents\Project\Files\Stocklist.txt" If CompanyName = "FranksCars" Then Discount = "15.00" ElseIf CompanyName = "MotorsRus" Then Discount = "10.00" Else Discount = "0.00" End If Open Stocklist For Random As #1 Len = Len(Product) Do While (Not EOF(1)) And (Found = False) RecordNumber = RecordNumber + 1 Get #1, RecordNumber, Product If Product.TyreName = TyreType Then Found = True TotalNoVAT = Product.TyrePrice * TyreNo lblTotalNoVAT.Caption = TotalNoVAT End If Loop Close #1 End Sub
Is the code i currently have. Neither works unfortunately. The first bit to calculate the discount, is entering 0.00 everytime, even if i enter one of the Companys Specified to have a discount. The second one isn't giving any response whatsoever, and i have absolutely no clue how to go about fixing these.
If anyone can help i would be most grateful.
Thanks and Kind Regards