The follow code works, when I search a complete names like "MARK", but when I search names that begin with letter "M" (for example), DataGrid Control is in blank
this is the code:
Dim con As ADODB.Connection
Set con = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
With con
.ConnectionString = "Data Source=" & App.Path & "\sales.mdb"
.Provider = "Microsoft.Jet.OLEDB.4.0;"
.Open
End With
<< here is the problem >>
sql = "SELECT * FROM employee WHERE Name like 'J*'"
<< when I write, ... Name like 'JOHNSON'" ... work >>
<< but, when I write, ... Name like 'J*'" ... not work >>
With rs
.ActiveConnection = con
.Source = sql
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.Open
End With
Set DataGrid1.DataSource = rs
How solve this?
this is the code:
Dim con As ADODB.Connection
Set con = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
With con
.ConnectionString = "Data Source=" & App.Path & "\sales.mdb"
.Provider = "Microsoft.Jet.OLEDB.4.0;"
.Open
End With
<< here is the problem >>
sql = "SELECT * FROM employee WHERE Name like 'J*'"
<< when I write, ... Name like 'JOHNSON'" ... work >>
<< but, when I write, ... Name like 'J*'" ... not work >>
With rs
.ActiveConnection = con
.Source = sql
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.Open
End With
Set DataGrid1.DataSource = rs
How solve this?