I could not duplicate the problem using your code. Here is what I used against the Northwind database.
VB Code:
Private Sub Command1_Click() Dim sConnect As String Dim sSQL As String Dim dfwConn As ADODB.Connection Dim datPrimaryRs As New ADODB.Recordset 'set strings sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\projects\northwind2002.mdb;Persist Security Info=False" sSQL = "select CustomerId, CompanyName, Country, Region From Customers where CustomerId Like '" & Text1.Text & "'" ' open connection Set dfwConn = New ADODB.Connection dfwConn.Open sConnect 'create a recordset using the provided collection datPrimaryRs.CursorLocation = adUseClient datPrimaryRs.Open sSQL, dfwConn, adOpenForwardOnly, adLockReadOnly Set MSHFlexGrid1.DataSource = datPrimaryRs With MSHFlexGrid1 .ColWidth(0) = 250 .ColWidth(1) = 0 .ColWidth(2) = 2500 .ColWidth(3) = 1000 .ColWidth(4) = 800 .ColAlignment(1) = 4 .ColAlignment(3) = 4 .ColAlignment(4) = 4 .ColAlignmentFixed = 4 .Row = 0 .Col = 2 .Text = "Company Name" .Col = 3 .Text = "Country" .Col = 4 .Text = "Region" End With End Sub Private Sub MSHFlexGrid1_Click() Debug.Print Me.MSHFlexGrid1.TextMatrix(Me.MSHFlexGrid1.MouseRow, 1), Me.MSHFlexGrid1.TextMatrix(Me.MSHFlexGrid1.MouseRow, 2) End Sub
Is there any other code in other events that may be contributing to the problem?




Reply With Quote