so I'm trying to make a code using datagrid and a textbox where everytime the user types in a letter or a number the datagrid narrows it's search
this is my code
this is my code
Code:
Private Sub txtSearch_Change()
Call connect
With rs
.ActiveConnection = con
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
End With
rs.Open "SELECT * FROM account WHERE LastName LIKE '" & Replace(txtSearch.Text, "'", "") & "%'"
Set Me.DataGrid1.DataSource = rs
End Sub
Function dgAct()
Call connect
With rs
.ActiveConnection = con
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
End With
rs.Open "SELECT * FROM account WHERE LastName LIKE '" & Replace(txtSearch.Text, "'", "") & "%'"
Set Me.DataGrid1.DataSource = rs
con.Close
End Function
Private Sub Form_Load()
Call connect
With rs
.ActiveConnection = con
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
End With
rs.Open "SELECT * FROM account"
Set Me.DataGrid1.DataSource = rs
End Sub