Option Explicit
Dim c As New Connection
Dim r As New Recordset
Dim sql As String
Dim n, tot As Integer
Private Sub cmdBill_Click()
With frmbill
.Label7 = Text1.Text
.Label8 = Text2.Text
.Label10 = Text3.Text
.Label11 = Text4.Text
.Label14 = Now
End With
frmbill.Show
End Sub
Private Sub cmdContinue_Click()
r.Close
sql = "insert into tblTicket values (" & Val(Text1.Text) & "," & Val(Text2.Text) & " ," & List1.Text & ", " & Val(Text3.Text) & " ," & Val(Text4.Text) & ")"
r.Open sql, c, adOpenDynamic, adLockOptimistic
If n > 0 Then MsgBox "Successfully Added"
Text1.Text = " "
Text2.Text = " "
List1.Text = " "
Text3.Text = " "
Text4.Text = ""
Text1.SetFocus
End Sub
Private Sub cmdExit_Click()
c.Close
Unload Me
End Sub
Private Sub Form_Load()
c.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\assign\remaining vb\Slip27\Ques-2\Ticket.mdb;Persist Security Info=False"
tot = 0
List1.Clear
List1.AddItem "Balcony"
List1.AddItem "Upper"
List1.AddItem "Lower"
End Sub
Private Sub List1_Click()
n = Val(Text2.Text)
If List1.Text = "Balcony" Then
Text3.Text = 200
Text4.Text = n * Val(Text3.Text)
ElseIf List1.Text = "Upper" Then
Text3.Text = 140
Text4.Text = n * Val(Text3.Text)
Else
Text3.Text = 80
Text4.Text = n * Val(Text3.Text)
End If
End Sub
Dim c As New Connection
Dim r As New Recordset
Dim sql As String
Dim n As Integer<
Dim charge As Integer
Private Sub cmdDel_Click()
n = Val(InputBox("Enter User number"))
sql = "delete from tblTicket where (UserNumber=" & n & ")"
r.Open sql, c, adOpenDynamic, adLockOptimistic
grid.Clear
sql = "select * from tblTicket order by Category"
r.Open sql, c, adOpenDynamic, adLockOptimistic
grid.Row = 1
grid.FormatString = "|User no|No Of Ticket|Category|Amount|Total Amount"
grid.ColWidth(1) = 1000
grid.ColWidth(2) = 1500
grid.ColWidth(3) = 1000
grid.ColWidth(4) = 2000
grid.ColWidth(5) = 1200
While r.EOF = False
grid.TextMatrix(grid.Row, 1) = r.Fields(0).Value
grid.TextMatrix(grid.Row, 2) = r.Fields(1).Value
grid.TextMatrix(grid.Row, 3) = r.Fields(2).Value
grid.TextMatrix(grid.Row, 4) = r.Fields(3).Value
grid.TextMatrix(grid.Row, 5) = r.Fields(4).Value
grid.Row = grid.Row + 1
r.MoveNext
Wend
r.Close
End Sub
Private Sub Form_Load()
grid.Refresh
c.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\assign\remaining vb\Slip27\Ques-2\Ticket.mdb;Persist Security Info=False"
sql = "select * from tblTicket order by Category"
r.Open sql, c, adOpenDynamic, adLockOptimistic
grid.Row = 1
grid.FormatString = "|User no|No Of Ticket|Category|Amount|Total Amount"
grid.ColWidth(1) = 1000
grid.ColWidth(2) = 1500
grid.ColWidth(3) = 1000
grid.ColWidth(4) = 2000
grid.ColWidth(5) = 1200
While r.EOF = False
grid.TextMatrix(grid.Row, 1) = r.Fields(0).Value
grid.TextMatrix(grid.Row, 2) = r.Fields(1).Value
grid.TextMatrix(grid.Row, 3) = r.Fields(2).Value
grid.TextMatrix(grid.Row, 4) = r.Fields(3).Value
grid.TextMatrix(grid.Row, 5) = r.Fields(4).Value
grid.Row = grid.Row + 1
r.MoveNext
Wend
r.Close
End Sub
Recent Posts
Posted on 2019-07-18
Posted on 2019-07-18
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-07-17
Posted on 2019-05-28
Posted on 2019-05-24
Posted on 2019-05-24
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23
Posted on 2019-05-23