Case 2:
asssembled_Click Case 3:
bronded_Click Case 4:
logoff_Click Case 5:
Exit_Click End Select End Sub
Sell computer part
Dim price As Double Dim temp As String Dim bool As Boolean Dim p1, p2 As Double Dim w1, w2 As Integer Private Sub Clearall_Click() End Sub
Private Sub Combo19_Click() Combo27.Clear
temp = "RAM"
If rs3.State = adStateOpen Then rs3.Close
44
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & Comboram.Text & "' and Type='" & Combo19.Text & "'"
While rs3.EOF = False
Combo27.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combo20_Click() Combo28.Clear
temp = "Processor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & ComboProcessor.Text & "' and Type='" & Combo20.Text & "'"
While rs3.EOF = False
Combo28.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combo21_Click() Combo29.Clear
temp = "MotherBoard"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & Combomotherboard.Text & "' and Type='" & Combo21.Text & "'"
While rs3.EOF = False
Combo29.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combo22_Click() temp = "Mouse"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combomouse.Text & "' and Type='" & Combo22.Text & "'"
While rs3.EOF = False Combo45.AddItem rs3(0) rs3.MoveNext
Wend End Sub
45
Private Sub Combo23_Click() Combo30.Clear
temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & Combospeaker.Text & "' and Type='" & Combo23.Text & "'"
While rs3.EOF = False
Combo30.AddItem rs3(0)
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & Combomonitor.Text & "' and Type='" & Combo24.Text & "'"
While rs3.EOF = False
Combo31.AddItem rs3(0)
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combomodem.Text & "' and Type='" & Combo25.Text & "'"
While rs3.EOF = False Combo49.AddItem rs3(0) rs3.MoveNext
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Comboram.Text & "' and Type='" & Combo19.Text & "' and Range='" & Combo27.Text & "'"
While rs3.EOF = False Combo38.AddItem rs3(0) rs3.MoveNext
46
Wend End Sub
Private Sub Combo28_Click() Combo39.Clear
temp = "Processor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & ComboProcessor.Text & "' and Type='" & Combo20.Text & "' and Range='" & Combo28.Text & "'"
While rs3.EOF = False Combo39.AddItem rs3(0) rs3.MoveNext
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combomotherboard.Text & "' and Type='" & Combo21.Text & "' and Range='" & Combo29.Text & "'"
While rs3.EOF = False Combo40.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combo30_Click() temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combospeaker.Text & "' and Type='" & Combo23.Text & "' and Range='" & Combo30.Text & "'"
While rs3.EOF = False Combo46.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combo31_Click() temp = "Monitor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combomonitor.Text & "' and Type='" & Combo24.Text & "' and Range='" & Combo31.Text & "'"
While rs3.EOF = False Combo47.AddItem rs3(0) rs3.MoveNext
47
Wend End Sub
Private Sub Combo34_Click() temp = "Printer"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Comboprinter.Text & "' and Type='" & Combo34.Text & "'"
While rs3.EOF = False Combo51.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combo35_Click() Static i As Integer
Static hdprice As Double
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo35.Text & "'"
text4.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo36_Click() Static cdrprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo36.Text & "'"
Text5.Text = rs3(0)
price = price + cdrprice End If
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22) End Sub
Private Sub Combo37_Click() Static cdwprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo37.Text & "'"
Text6.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo38_Click() Static ramprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo38.Text & "'"
Text7.Text = rs3(0) Text23 = price + Val(Text22) End Sub
49
Private Sub Combo39_Click() Static proprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo39.Text & "'"
Text8.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo40_Click() Static mbprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo40.Text & "'"
Text9.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo41_Click() Static fdprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo41.Text & "'"
Text10 = rs3(0)
50
If i = 0 Then Text23 = price + Val(Text22) End Sub
Private Sub Combo42_Click() Static dvdrprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo42.Text & "'"
Text11.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo43_Click() Static dvdwprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo43.Text & "'"
Text12.Text = rs3(0)
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22) End Sub
Private Sub Combo44_Click() Static kbdprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo44.Text & "'"
Text13.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo45_Click() Static msprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo45.Text & "'"
Text14.Text = rs3(0) Text23 = price + Val(Text22)
52
End Sub
Private Sub Combo46_Click() Static spkprice As Double Static i As Integer
'temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo46.Text & "'"
Text15.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo47_Click() Static monprice As Double Static i As Integer
'temp = "Monitor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo47.Text & "'"
Text16.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo48_Click()
53
Static upsprice As Double Static i As Integer
'temp = "UPS"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo48.Text & "'"
Text17.Text = rs3(0) If i = 0 Then
upsprice = Val(Text17) price = price + upsprice Else
price = price - upsprice upsprice = Val(Text17) price = price + upsprice End If
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22) End Sub
Private Sub Combo49_Click() Static modprice As Double Static i As Integer
'temp = "Modem"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo49.Text & "'"
Text18.Text = rs3(0) If i = 0 Then
modprice = Val(Text18) price = price + modprice Else
price = price - modprice modprice = Val(Text18) price = price + modprice End If
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22) End Sub
54
Private Sub Combo50_Click() Static lcardprice As Double Static i As Integer
'temp = "LAN Card"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo50.Text & "'"
Text19.Text = rs3(0) If i = 0 Then
lcardprice = Val(Text19) price = price + lcardprice Else
price = price - lcarddprice lcardprice = Val(Text19) price = price + lcardprice End If
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22) End Sub
Private Sub Combo51_Click() Static prprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo51.Text & "'"
Text20.Text = rs3(0) If i = 0 Then
prprice = Val(Text20) price = price + prprice Else
price = price - prprice prprice = Val(Text20) price = price + prprice End If
i = i + 1
Text21 = price
Text22 = price * 4 / 100 Text23 = price + Val(Text22) End Sub
55
Private Sub Combo52_Click() Static scnprice As Double Static i As Integer
'temp = "Scanner"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo52.Text & "'"
Text27.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combo53_Click() Static cabprice As Double Static i As Integer
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Price from itemdetail where Serialno='" & Combo53.Text & "'"
Text28.Text = rs3(0) Text23 = price + Val(Text22) End Sub
Private Sub Combocabinet_Click() temp = "Cabinet"
If rs3.State = adStateOpen Then rs3.Close
56
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combocabinet.Text & "'"
While rs3.EOF = False Combo53.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combocdrom_Click() Combo36.Clear
temp = "CD ROM"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combocdrom.Text & "'"
While rs3.EOF = False Combo36.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combocdwriter_Click() Combo37.Clear
temp = "CD Writer"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combocdwriter.Text & "'"
While rs3.EOF = False Combo37.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combodvdrom_Click() temp = "DVD ROM"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combodvdrom.Text & "'"
While rs3.EOF = False Combo42.AddItem rs3(0) rs3.MoveNext
Wend End Sub
57
Private Sub Combodvdwriter_Click() temp = "DVD Writer"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combodvdwriter.Text & "'"
While rs3.EOF = False Combo43.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combofloppy_Click() Combo41.Clear
temp = "Floppy Drive"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combofloppy.Text & "'"
While rs3.EOF = False Combo41.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Comboharddisk_Click() temp = "Hard Disk"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Comboharddisk.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Comboharddisk.Text Then bool = True For i = 0 To Comboharddisktype.ListCount
If Comboharddisktype.List(i) = rs3(1) Then bool = False Next
If bool = True Then
Comboharddisktype.AddItem rs3(1) Else
bool = True End If
rs3.MoveNext Wend
End Sub
58
Private Sub Comboharddiskrange_Click() Combo35.Clear
temp = "Hard Disk"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Comboharddisk.Text & "' and Type='" & Comboharddisktype.Text
& "' and Range='" & Comboharddiskrange.Text & "'"
While rs3.EOF = False Combo35.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Comboharddisktype_Click() Comboharddiskrange.Clear
harddiskprice = ""
temp = "Hard Disk"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Range from itemdetail where Itemname='" & temp & "' and Company='" & Comboharddisk.Text & "' and Type='" & Comboharddisktype.Text
& "'"
While rs3.EOF = False
Comboharddiskrange.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combokeyboard_Click() temp = "Keyboad"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combokeyboard.Text & "'"
While rs3.EOF = False Combo44.AddItem rs3(0) rs3.MoveNext
Wend End Sub
59
Private Sub Combolan_Click() temp = "LAN Card"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Combolan.Text & "'"
While rs3.EOF = False Combo50.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combomodem_Click() temp = "Modem"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Combomodem.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomodem.Text Then bool = True For i = 0 To Combo25.ListCount
If Combo25.List(i) = rs3(1) Then bool = False Next
If bool = True Then Combo25.AddItem rs3(1) Else
bool = True End If
rs3.MoveNext Wend
End Sub
Private Sub Combomonitor_Click() temp = "Monitor"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Combomonitor.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomonitor.Text Then bool = True For i = 0 To Combo24.ListCount
If Combo24.List(i) = rs3(1) Then bool = False Next
If bool = True Then Combo24.AddItem rs3(1)
60
Else
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Combomotherboard.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomotherboard.Text Then bool = True For i = 0 To Combo21.ListCount
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Combomouse.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combomouse.Text Then bool = True
End Sub
Private Sub Comboprinter_Click() temp = "Printer"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Comboprinter.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Comboprinter.Text Then bool = True
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & ComboProcessor.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = ComboProcessor.Text Then bool = True
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Comboram.Text & "'"
While rs3.EOF = False
62
If rs3.Fields(0).Value = Comboram.Text Then bool = True
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Comboscanner.Text & "'"
While rs3.EOF = False Combo52.AddItem rs3(0) rs3.MoveNext
Wend End Sub
Private Sub Combospeaker_Click() temp = "Speaker"
If rs3.State = adStateOpen Then rs3.Close
rs3.Open "select Company,Type from itemdetail where Itemname='" & temp & "' and Company='" & Combospeaker.Text & "'"
While rs3.EOF = False
If rs3.Fields(0).Value = Combospeaker.Text Then bool = True
If rs3.State = adStateOpen Then rs3.Close
63
rs3.Open "select Serialno from itemdetail where Itemname='" & temp & "' and Company='" & Comboups.Text & "'"
While rs3.EOF = False Combo48.AddItem rs3(0) rs3.MoveNext
'If rs2.State = 1 Then rs2.Close
'rs2.Open "Select * from setsold", cs, adOpenKeyset, adLockOptimistic invoice.Caption = "S" & (rs2.RecordCount + 1)
64
invoice.FontBold = True
Label38.Caption = "cust" & (rs2.RecordCount + 1) price = 0
Dim bool As Boolean While rs3.EOF = False
If rs3.Fields(0).Value = "Hard Disk" Then bool = True
ElseIf rs3.Fields(0).Value = "CD ROM" Then bool = True
ElseIf rs3.Fields(0).Value = "CD Writer" Then bool = True
ElseIf rs3.Fields(0).Value = "RAM" Then bool = True
ElseIf rs3.Fields(0).Value = "Processor" Then
65
bool = True
For i = 0 To ComboProcessor.ListCount
If ComboProcessor.List(i) = rs3(1) Then bool = False
ElseIf rs3.Fields(0).Value = "MotherBoard" Then bool = True
For i = 0 To Combomotherboard.ListCount
If Combomotherboard.List(i) = rs3(1) Then bool = False
ElseIf rs3.Fields(0).Value = "Floppy Drive" Then bool = True
ElseIf rs3.Fields(0).Value = "Cabinet" Then bool = True
ElseIf rs3.Fields(0).Value = "DVD ROM" Then bool = True
Else
bool = True End If
ElseIf rs3.Fields(0).Value = "DVD Writer" Then bool = True
For i = 0 To Combodvdwriter.ListCount
If Combodvdwriter.List(i) = rs3(1) Then bool = False
ElseIf rs3.Fields(0).Value = "Keyboad" Then bool = True
ElseIf rs3.Fields(0).Value = "Mouse" Then bool = True
ElseIf rs3.Fields(0).Value = "Speaker" Then bool = True
ElseIf rs3.Fields(0).Value = "Monitor" Then bool = True
For i = 0 To Combomonitor.ListCount
67
If Combomonitor.List(i) = rs3(1) Then bool = False
ElseIf rs3.Fields(0).Value = "UPS" Then bool = True
ElseIf rs3.Fields(0).Value = "Modem" Then bool = True
ElseIf rs3.Fields(0).Value = "LAN Card" Then bool = True
ElseIf rs3.Fields(0).Value = "Printer" Then bool = True
End If
ElseIf rs3.Fields(0).Value = "Scanner" Then bool = True
Private Sub Form_Unload(cancel As Integer) con.Close On Error Resume Next:
sellcomputer.PrintForm End Sub
Private Sub save_Click()
b = (MsgBox("are you sure you want to save?", vbYesNo, conformation)) If b <> 6 Then
Exit Sub End If
If Combo35.Text = "" Then End If
If Combo36.Text = "" Then End If
If Combo37.Text = "" Then End If
If Combo38.Text = "" Then End If
If Combo39.Text = "" Then End If
If Combo40.Text = "" Then End If
If Combo41.Text = "" Then
69
End If
If Combo42.Text = "" Then End If
If Combo43.Text = "" Then End If
If Combo44.Text = "" Then End If
If Combo45.Text = "" Then End If
If Combo46.Text = "" Then End If
If Combo47.Text = "" Then End If
If Combo48.Text = "" Then End If
If Combo49.Text = "" Then End If
If Combo50.Text = "" Then End If
If Combo51.Text = "" Then End If
If Combo52.Text = "" Then End If
If Combo53.Text = "" Then End If
If vkTextBox1.Text = "" Then
MsgBox " Customer Name is Empty"
vkTextBox1.SetFocus Exit Sub
ElseIf vkTextBox2.Text = "" Then
MsgBox " Customer Address is Empty"
vkTextBox2.SetFocus Exit Sub
ElseIf vkTextBox3.Text = "" Then
MsgBox " Customer Pnone No is Empty"
vkTextBox3.SetFocus Exit Sub
End If
If text4.Text = "" And Text5.Text = "" And Text6.Text = "" And Text7.Text = "" And Text8.Text = "" _
And Text9.Text = "" And Text10.Text = "" And Text11.Text = "" And Text12.Text
= "" And Text13.Text = "" _
And Text14.Text = "" And Text15.Text = "" And Text16.Text = "" And Text17.Text
= "" And Text18.Text = "" _
70
And Text19.Text = "" And Text20.Text = "" And Text27.Text = "" And Text28.Text
= "" Then
MsgBox "Any product is not choosen by you. Please choose any product."
Exit Sub End If
If Text24.Text = "" Then
MsgBox " Payment Amount is Empty", vbInformation Text24.SetFocus
Exit Sub
ElseIf Not IsNumeric(Text24) Then
MsgBox " Payment Amount should be numaric", vbInformation
MsgBox " Payment Amount should be numaric", vbInformation