Ok, I have a txt box and when the textbox text changes its supposed to run an sql statement to fill the mshflexgrid. Which it does. BUT when you search more than once (without closing the frm in between)then click a line in the flexgrid to select a record it gives you the data for the line above the one you clicked...

Im thinking the mshflexgrid isnt resetting or something in between. I tried the refresh property, the redraw property, the clear & Clear structure properties, etc. I dont know what else I can do.

Here is my code to fill the mshflexgrid...

VB Code:
  1. Dim sConnect As String
  2.     Dim sSQL As String
  3.     Dim dfwConn As ADODB.Connection
  4.     Dim datPrimaryRs As New ADODB.Recordset
  5.        
  6.     'set strings
  7.     sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & frmlocation.Text1.Text & "';Persist Security Info=False"
  8.     sSQL = "select InsRecID, SpecID, Insurance, InsuranceID from DrsInsuranceList where SpecID like '" & Text7.Text & "'"
  9.  
  10.     ' open connection
  11.     Set dfwConn = New ADODB.Connection
  12.     dfwConn.Open sConnect
  13.    
  14.     'create a recordset using the provided collection
  15.     datPrimaryRs.CursorLocation = adUseClient
  16.     datPrimaryRs.Open sSQL, dfwConn, adOpenForwardOnly, adLockReadOnly
  17.    
  18.     Set MSHFlexGrid1.DataSource = datPrimaryRs
  19.    
  20.     With MSHFlexGrid1
  21.     .ColWidth(0) = 250
  22.     .ColWidth(1) = 0
  23.     .ColWidth(2) = 1500
  24.     .ColWidth(3) = 1500
  25.     .ColWidth(4) = 1500
  26.     .ColAlignment(1) = 4
  27.     .ColAlignment(3) = 4
  28.     .ColAlignment(4) = 4
  29.     .ColAlignmentFixed = 4
  30.     .Row = 0
  31.     .Col = 2
  32.     .Text = "Specialist ID"
  33.     .Col = 3
  34.     .Text = "Insurance"
  35.     .Col = 4
  36.     .Text = "Insurance ID"
  37.     End With

Ideas?