You are on page 1of 6

Dim con As New ADODB.Connection Dim rs As New ADODB.Recordset Dim rs1 As New ADODB.Recordset Dim rs2 As New ADODB.

Recordset Dim rs3 As ADODB.Recordset Private Sub Command1_Click() rs3.Open "select * from res_avail", con, adOpenDynamic, adLockOptimistic Set g1.Recordset = rs3 rs3.Close End Sub Private Sub Command10_Click() Command11.Visible = False Command12.Visible = False Label7.Visible = False Label9.Visible = False Label10.Visible = False Label11.Visible = False Text6.Visible = False Text7.Visible = False Text9.Visible = False Text10.Visible = False Label12.Visible = False Text8.Visible = False a = Val(InputBox("Enter Shop no.")) rs2.Open "select * from cumm_avail where shop_no=" & a & "", con, adOpenStatic, adLockOptimistic If rs2.RecordCount = 1 Then MsgBox ("Record found") con.Execute "delete from cumm_avail where shop_no=" & a & "" MsgBox ("Record deleted.") Else MsgBox ("Record not deleted.") End If rs2.Close rs3.Open "select * from cumm_avail", con, adOpenDynamic, adLockOptimistic Set g2.Recordset = rs3 rs3.Close End Sub Private Sub Command11_Click() rs2.Open "select * from cumm_avail where shop_no=" & Text6.Text & "", con, adOpe nStatic, adLockOptimistic If rs2.RecordCount = 1 Then rs2!shop_no = Text6.Text rs2!carpt_area = Text7.Text rs2!floor_no = Text10.Text rs2!Rate = Text9.Text rs2!Status = Text8.Text rs2.Update MsgBox ("Record updated.") Else MsgBox ("Record not updated.") End If rs2.Close rs3.Open "select * from cumm_avail", con, adOpenDynamic, adLockOptimistic

Set g2.Recordset = rs3 rs3.Close End Sub Private Sub Command12_Click() If Text7.Text = "" Or Text10.Text = "" Or MsgBox ("ENTER ALL DETAILS.") Else Set rs1 = New ADODB.Recordset rs1.Open "select * from cumm_avail", con, rs.Open "select * from cumm_avail ", con, If rs1.BOF = True And rs.EOF = True Then Text6.Text = 1 Else rs1.MoveLast Text6.Text = rs1!shop_no Text6.Text = Text6.Text + 1 rs1.Close rs.Close End If Set rs1 = New ADODB.Recordset rs1.Open "select * from cumm_avail", con, rs1.AddNew rs1!shop_no = Text6.Text rs1!carpt_area = Text7.Text rs1!floor_no = Text10.Text rs1!Rate = Text9.Text rs1!Status = Text8.Text rs1.Update rs1.Close End If rs3.Open "select * from cumm_avail", con, Set g2.Recordset = rs3 rs3.Close End Sub Private Sub Command2_Click() Command5.Visible = False Command6.Visible = True Label1.Visible = False Label2.Visible = True Label3.Visible = True Label4.Visible = True Label5.Visible = True Text1.Visible = False Text2.Visible = True Text3.Visible = True Text4.Visible = True Combo1.Visible = True Text5.Visible = False Label6.Visible = False End Sub Private Sub Command3_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Combo1.Text = "" Text9.Text = "" Then

adOpenStatic, adLockOptimistic adOpenStatic, adLockOptimistic

adOpenStatic, adLockOptimistic

adOpenDynamic, adLockOptimistic

MsgBox ("Select Flat no.from the list.") Command5.Visible = True Command6.Visible = False Label1.Visible = False Label2.Visible = True Label3.Visible = True Label4.Visible = True Label5.Visible = True Text1.Visible = False Text2.Visible = True Text3.Visible = True Text4.Visible = True Combo1.Visible = True Text5.Visible = False Label6.Visible = False End Sub Private Sub Command4_Click() Command5.Visible = False Command6.Visible = False Label1.Visible = False Label2.Visible = False Label3.Visible = False Label4.Visible = False Label5.Visible = False Label6.Visible = False Text1.Visible = False Text2.Visible = False Text3.Visible = False Text4.Visible = False Combo1.Visible = False Text5.Visible = False a = Val(InputBox("Enter Flat no.")) rs2.Open "select * from res_avail where flat_no=" & a & "", con, adOpenStatic, a dLockOptimistic If rs2.RecordCount = 1 Then MsgBox ("Record found") con.Execute "delete from res_avail where flat_no=" & a & "" MsgBox ("Record deleted.") Else MsgBox ("Record not deleted.") End If rs2.Close rs3.Open "select * from res_avail", con, adOpenDynamic, adLockOptimistic Set g1.Recordset = rs3 rs3.Close End Sub Private Sub Command5_Click() rs2.Open "select * from res_avail where flat_no=" & Text1.Text & "", con, adOpen Static, adLockOptimistic If rs2.RecordCount = 1 Then rs2!flat_no = Text1.Text rs2!rooms = Combo1.Text rs2!carpt_area = Text2.Text rs2!floor_no = Text3.Text rs2!Rate = Text4.Text rs2!Status = Text5.Text

rs2.Update MsgBox ("Record updated.") Else MsgBox ("Record not updated.") End If rs2.Close rs3.Open "select * from res_avail", con, adOpenDynamic, adLockOptimistic Set g1.Recordset = rs3 rs3.Close End Sub Private Sub Command6_Click() If Text2.Text = "" Or Combo1.Text = n MsgBox ("ENTER ALL DETAILS.") Else Set rs1 = New ADODB.Recordset rs1.Open "select * from res_avail", rs.Open "select * from res_avail ", If rs1.BOF = True And rs.EOF = True Text1.Text = 1 Else rs1.MoveLast Text1.Text = rs1!flat_no Text1.Text = Text1.Text + 1 rs1.Close rs.Close End If Set rs1 = New ADODB.Recordset rs1.Open "select * from res_avail", rs1.AddNew rs1!flat_no = Text1.Text rs1!rooms = Combo1.Text rs1!carpt_area = Text2.Text rs1!floor_no = Text3.Text rs1!Rate = Text4.Text rs1!Status = Text5.Text rs1.Update rs1.Close End If rs3.Open "select * from res_avail", Set g1.Recordset = rs3 rs3.Close End Sub "" Or Text3.Text = "" Or Text4.Text = "" The

con, adOpenStatic, adLockOptimistic con, adOpenStatic, adLockOptimistic Then

con, adOpenStatic, adLockOptimistic

con, adOpenDynamic, adLockOptimistic

Private Sub Command7_Click() rs3.Open "select * from cumm_avail", con, adOpenDynamic, adLockOptimistic Set g2.Recordset = rs3 rs3.Close End Sub Private Sub Command8_Click() Command11.Visible = False Command12.Visible = True Label7.Visible = False Label9.Visible = True Label10.Visible = True Label11.Visible = True

Text6.Visible = False Text7.Visible = True Text9.Visible = True Text10.Visible = True Label12.Visible = False Text8.Visible = False End Sub Private Sub Command9_Click() Text6.Text = "" Text7.Text = "" Text8.Text = "" Text9.Text = "" Text10.Text = "" MsgBox ("Select Shop no.from the list.") Command12.Visible = False Command11.Visible = True Label7.Visible = False Label9.Visible = True Label10.Visible = True Label11.Visible = True Text6.Visible = False Text7.Visible = True Text9.Visible = True Text10.Visible = True Label12.Visible = False Text8.Visible = False End Sub Private Sub Form_Load() Set con = New ADODB.Connection Set rs3 = New ADODB.Recordset con.Open "Provider=OraOLEDB.Oracle.1;Password=tiger;Persist Security Info=True;U ser ID=scott" End Sub Private Sub g1_Click() Text1.Text = g1.TextMatrix(g1.Row, 1) Combo1.Text = g1.TextMatrix(g1.Row, 2) Text2.Text = g1.TextMatrix(g1.Row, 3) Text3.Text = g1.TextMatrix(g1.Row, 4) Text4.Text = g1.TextMatrix(g1.Row, 5) Text5.Text = g1.TextMatrix(g1.Row, 6) End Sub Private Sub g2_Click() Text6.Text = g2.TextMatrix(g2.Row, 1) Text7.Text = g2.TextMatrix(g2.Row, 2) Text10.Text = g2.TextMatrix(g2.Row, 3) Text9.Text = g2.TextMatrix(g2.Row, 4) Text8.Text = g2.TextMatrix(g2.Row, 5) End Sub Private Sub Combo1_(KeyAscii As Integer) MsgBox ("Select From Drop down List.") KeyAscii = 0 End Sub Private Sub text2_KeyPress(KeyAscii As Integer) a = Module2.TestForInt(KeyAscii) If a = True Then MsgBox ("Enter Numbers Only (0 to 9).Space is not allowed.")

KeyAscii = 0 End If End Sub Private Sub text3_KeyPress(KeyAscii As Integer) a = Module2.TestForInt(KeyAscii) If a = True Then MsgBox ("Enter Numbers Only (0 to 9).Space is not allowed.") KeyAscii = 0 End If End Sub Private Sub text7_KeyPress(KeyAscii As Integer) a = Module2.TestForInt(KeyAscii) If a = True Then MsgBox ("Enter Numbers Only (0 to 9).Space is not allowed.") KeyAscii = 0 End If End Sub Private Sub text9_KeyPress(KeyAscii As Integer) a = Module2.TestForInt(KeyAscii) If a = True Then MsgBox ("Enter Numbers Only (0 to 9).Space is not allowed.") KeyAscii = 0 End If End Sub Private Sub text4_KeyPress(KeyAscii As Integer) a = Module2.TestForInt(KeyAscii) If a = True Then MsgBox ("Enter Numbers Only (0 to 9).Space is not allowed.") KeyAscii = 0 End If End Sub Private Sub text10_KeyPress(KeyAscii As Integer) a = Module2.TestForInt(KeyAscii) If a = True Then MsgBox ("Enter Numbers Only (0 to 9).Space is not allowed.") KeyAscii = 0 End If End Sub

You might also like