I know there has to be a better way to load the grid than the one i use. My db is about 40k records and this is how i load the grid
strSearch = UCase(txtName) & "%"
objComm.CommandText = "Select field from table where lastname like '" & strSearch & "' order by lastname"
objComm.CommandType = adCmdText
Set objRec = New ADODB.Recordset
Set objRec.Source = objComm
objRec.Open
If objRec.EOF Or objRec.BOF Then
msgbox("blah blah"
Else
While Not objRec.EOF
MSFlexGrid1.Col = 0
MSFlexGrid1.Row = i
If Not IsNull(objRec("field"
) Then
MSFlexGrid1.Text = objRec("field"
End If
objRec.MoveNext
Wend
End if
now if the Search string is a few characters like AB the grid loads fine but if the search string is one character like A or M it takes forever.
Anything I can do to speed this up?
I am new to VB so dont know too much
strSearch = UCase(txtName) & "%"
objComm.CommandText = "Select field from table where lastname like '" & strSearch & "' order by lastname"
objComm.CommandType = adCmdText
Set objRec = New ADODB.Recordset
Set objRec.Source = objComm
objRec.Open
If objRec.EOF Or objRec.BOF Then
msgbox("blah blah"
Else
While Not objRec.EOF
MSFlexGrid1.Col = 0
MSFlexGrid1.Row = i
If Not IsNull(objRec("field"
MSFlexGrid1.Text = objRec("field"
End If
objRec.MoveNext
Wend
End if
now if the Search string is a few characters like AB the grid loads fine but if the search string is one character like A or M it takes forever.
Anything I can do to speed this up?
I am new to VB so dont know too much