Option Explicit Private Sub Command1_Click() End End Sub Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer) DisplayRecord If Adodc1.Recordset.EOF Then Adodc1.Caption = "Record: EOF of " & Adodc1.Recordset.RecordCount Else Adodc1.Caption = "Record: " & Adodc1.Recordset.AbsolutePosition & " of " & Adodc1.Recordset.RecordCount End If End Sub Private Sub Form_Load() DisplayRecord End Sub Private Sub txtFind_Change() If Not Trim(txtFind.Text) = "" Then txtFind.Text = UCase(txtFind.Text) txtFind.SelStart = Len(txtFind.Text) Adodc1.Recordset.Find "fld1 LIKE '" & txtFind.Text & "%'", , , 1 If Adodc1.Recordset.EOF Or Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst Else Text1.Text = Adodc1.Recordset.Fields(0) Text2.Text = Adodc1.Recordset.Fields(1) Text3.Text = Adodc1.Recordset.Fields(2) Adodc1.Caption = _ "Record: " & Adodc1.Recordset.AbsolutePosition & " of " & Adodc1.Recordset.RecordCount End If Else txtFind.Text = "" End If End Sub Private Sub DisplayRecord() If Not Adodc1.Recordset.EOF And Not Adodc1.Recordset.BOF Then Text1.Text = Adodc1.Recordset.Fields(0) Text2.Text = Adodc1.Recordset.Fields(1) Text3.Text = Adodc1.Recordset.Fields(2) End If End Sub |
Sebelum anda menjalankan program ini terlebih dahulu setting ADO Data Control-nya ke direktori dimana data COBA.MDB berada yaitu connectionstring. Untuk mendownload codenya Klik disini.
0 komentar:
Komentar Anda
Berikan komentar..