Private Sub cmdSearch_Click() Dim target_name As String Dim r As Integer
' Get the name. target_name = InputBox("Name", "Name", "") If Len(target_name) = 0 Then Exit Sub
' Search for the name, skipping the column heading row. target_name = LCase$(target_name) For r = 1 To Grid.Rows - 1 If LCase$(Grid.TextMatrix(r, 0)) = _ target_name Then ' We found the target. Select this row. Grid.Row = r Grid.RowSel = r Grid.Col = 0 Grid.ColSel = Grid.Cols - 1
' Make the row visible. Grid.TopRow = r Exit Sub End If Next r
With Grid Dim row As Integer: For row = 1 To .Rows - 1 If InStr(.TextMatrix(row, 1), Me.Text7.Text) > 0 Then .FocusRect = flexFocusNone .SelectionMode = flexSelectionByRow .row = row .Col = .Cols - 1 .ColSel = 1 .TopRow = IIf(row > 1, row - 1, row) Exit For End If Next End With
Private Sub Text1_Change()
Text1.BackColor = vbWhite
Dim ft
On Error GoTo 11:
prevbookmark = Adodc1.Recordset.Bookmark
ft = Text1.Text
If ft = "" Then
Adodc1.Recordset.Filter = adFilterNone
Else
Adodc1.Recordset.Filter = " country_name like '" & ft & "%'"
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.Bookmark = prevbookmark
End If
End If
Exit Sub
11:
Adodc1.Recordset.Filter = adFilterNone
Text1.BackColor = vbYellow
End Sub
حسب علمي تريد عمل بحث في التكست بوكس من اول حروف وظهور الجمل في قامة اللست
قل إني نهيت أن أعبد الذين تدعون من دون الله
لما جاءني البينات من ربي وأمرت أن أسلم لرب العالمين