Sie sind auf Seite 1von 29

Reservation report

Reception report

Travel desk report

Telephone operator

Business centre

Food report

Information report

Coding

Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim i As Integer

Private Sub addnew_Click() If rs.State Then rs.Close End If i = InputBox("Enter food ID") rs.Open "select * from tel", cn, adOpenDynamic, adLockOptimistic rs.MoveFirst While Not rs.EOF If rs(0) = i Then Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3)

End If rs.MoveNext

Wend End Sub

Private Sub Command1_Click() If rs.State Then rs.Close End If rs.Open "select * from tel", cn, adOpenDynamic, adLockOptimistic rs.MoveLast Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3)

End Sub

Private Sub Command2_Click() If rs.State Then rs.Close End If rs.Open "select * from tel", cn, adOpenDynamic, adLockOptimistic

rs.MoveNext If rs.EOF = True Then rs.MoveLast End If Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3)

MsgBox "last record reached" Call assign

End Sub

Private Sub Command3_Click() If rs.State Then rs.Close End If rs.Open "select * from tel ", cn, adOpenDynamic, adLockOptimistic rs.MovePrevious If rs.BOF = True Then rs.MoveFirst

End If Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3)

MsgBox "previous record reached" End Sub

Private Sub Command4_Click() If rs.State Then rs.Close End If rs.Open "select * from tel ", cn, adOpenDynamic, adLockOptimistic rs.MoveFirst Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3)

End Sub

Private Sub delete_Click() If rs.State Then rs.Close End If rs.Open "delete from tel where room='" & Text1.Text & "'", cn, adOpenDynamic, adLockOptimistic MsgBox "record deleted" Call assign End Sub

Private Sub exit_Click() Me.Hide

End Sub

Private Sub Form_Load() cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Data Source=;Persist Secuity Info=Tue" If rs.State = adStateOpen Then rs.Close End If

End Sub

Private Sub save_Click() rs.Open "insert into tel values('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "'," & Text4.Text & ")", cn, adOpenDynamic, adLockOptimistic MsgBox "record saved" Call assign End Sub

Private Sub UPDATE_Click() If rs.State Then rs.Close End If rs.Open "update tel set name='" & Text2.Text & "',caller='" & Text3.Text & "',phone=" & Text4.Text & " where room='" & Text1.Text & "'", cn, adOpenDynamic, adLockOptimistic Call assign MsgBox "RECORD UPDATED" End Sub Public Sub assign() Text1.Text = "" Text2.Text = "" Text3.Text = " " Text4.Text = " "

End Sub

Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim i As Integer

Private Sub addnew_Click() If rs.State Then rs.Close End If i = InputBox("Enter food ID") rs.Open "select * from bus1", cn, adOpenDynamic, adLockOptimistic rs.MoveFirst While Not rs.EOF If rs(0) = i Then Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3)

Text5.Text = rs(4) End If rs.MoveNext Wend End Sub

Private Sub Command1_Click() If rs.State Then rs.Close End If rs.Open "select * from bus1", cn, adOpenDynamic, adLockOptimistic rs.MoveLast Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4)

End Sub

Private Sub Command2_Click() If rs.State Then

rs.Close End If rs.Open "select * from bus1", cn, adOpenDynamic, adLockOptimistic rs.MoveNext If rs.EOF = True Then rs.MoveLast End If Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4)

MsgBox "last record reached" Call assign

End Sub

Private Sub Command3_Click() If rs.State Then rs.Close End If rs.Open "select * from bus1 ", cn, adOpenDynamic, adLockOptimistic

rs.MovePrevious If rs.BOF = True Then rs.MoveFirst

End If Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4)

MsgBox "previous record reached" End Sub

Private Sub Command4_Click() If rs.State Then rs.Close End If rs.Open "select * from bus1 ", cn, adOpenDynamic, adLockOptimistic rs.MoveFirst Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3)

Text5.Text = rs(4)

End Sub

Private Sub delete_Click() If rs.State Then rs.Close End If rs.Open "delete from bus1 where id=" & Text1.Text & "", cn, adOpenDynamic, adLockOptimistic MsgBox "record deleted" Call assign End Sub

Private Sub exit_Click() Me.Hide

End Sub

Private Sub Form_Load() cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Data Source=;Persist Secuity Info=Tue" If rs.State = adStateOpen Then rs.Close End If

End Sub Private Sub save_Click() rs.Open "insert into bus1 values(" & Text1.Text & ",'" & Text2.Text & "'," & Text3.Text & "," & Text4.Text & ",'" & Text5.Text & "')", cn, adOpenDynamic, adLockOptimistic MsgBox "record saved" Call assign End Sub

Private Sub UPDATE_Click() If rs.State Then rs.Close End If rs.Open "update bus1 set name='" & Text2.Text & "',usage=" & Text3.Text & ",amount=" & Text4.Text & ",room='" & Text5.Text & "'where id=" & Text1.Text & "", cn, adOpenDynamic, adLockOptimistic Call assign MsgBox "RECORD UPDATED" End Sub Public Sub assign() Text1.Text = "" Text2.Text = "" Text3.Text = " " Text4.Text = " " Text5.Text = " "

End Sub

Das könnte Ihnen auch gefallen