Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return to current position in Flexgrid

Status
Not open for further replies.

hpicken

Technical User
Apr 12, 2001
142
AU
Back again...

My MSHFlexGrid has the following in it (adapted from MS's example)

Code:
Private Sub Form_Resize()

    MSHFlexGrid1.Top = 1300
    MSHFlexGrid1.Left = 50
    MSHFlexGrid1.Visible = True
    If Me.Height > 2600 Then
        MSHFlexGrid1.Height = Me.Height - 2600
    End If
    If Me.Width > 200 Then
        MSHFlexGrid1.Width = Me.Width - 200
    End If
    MSHFlexGrid1.Clear
    MSHFlexGrid1.TopRow = 1
    MSHFlexGrid1.Rows = 2
    MSHFlexGrid1.Cols = 9
    Call GetHeaders
    
    Call FillGrid
    MSHFlexGrid1.ColWidth(0) = 0
    MSHFlexGrid1.ColWidth(1) = 0
    MSHFlexGrid1.ColWidth(2) = MSHFlexGrid1.Width / 4.8
    MSHFlexGrid1.ColWidth(3) = MSHFlexGrid1.Width / 4
    MSHFlexGrid1.ColWidth(4) = MSHFlexGrid1.Width / 15
    MSHFlexGrid1.ColWidth(5) = MSHFlexGrid1.Width / 10
    MSHFlexGrid1.ColWidth(6) = MSHFlexGrid1.Width / 2.8
    MSHFlexGrid1.ColWidth(7) = 0
    MSHFlexGrid1.ColWidth(8) = 0
    
    If frmNamesList.Width < 10890 Then frmNamesList.Width = 10890
    
End Sub



Sub FillGrid()

    MSHFlexGrid1.Clear
    MSHFlexGrid1.Visible = False
    MSHFlexGrid1.Rows = 2
    MSHFlexGrid1.TopRow = 1
    MSHFlexGrid1.FixedRows = 1
    MSHFlexGrid1.Cols = Rs.Fields.Count
    Call GetHeaders
    
    If ShowRecs Then
        Set MSHFlexGrid1.DataSource = Rs
    End If
    
    MSHFlexGrid1.Visible = True

End Sub



Private Sub GetHeaders()

    MSHFlexGrid1.TextMatrix(0, 2) = "Surname"
    MSHFlexGrid1.TextMatrix(0, 3) = "First Name"
    MSHFlexGrid1.TextMatrix(0, 4) = "ListType"
    MSHFlexGrid1.TextMatrix(0, 5) = "Event Date"
    MSHFlexGrid1.TextMatrix(0, 6) = "Register"

End Sub

For my connection I have...

Code:
Sub rs_Connector()

    Set Cn = New ADODB.Connection
    Cn.CursorLocation = adUseClient
    Cn.Mode = adModeRead
    Cn.Open "Provider=Microsoft.Jet.Oledb.4.0;Data Source=..\TCRDataSplit.mdb"

End Sub

As I understand things, when I click on a record, open another form, then close that form, the "cn.CursorLocation" should take me back to the record I clicked on in the Grid. Am I correct in this? However this does not happen, it goes back to the first record at the top of the grid.

My "FillGrid" function will refresh the grid and loose my record setting when the form is activate again (resizing), correct?

I call this function to refill the grid with data after a search.

If my assumptions are correct then how can I get the grid to highlight the row I orginally clicked so I can see where I was? (bugger bookmarks are not supported)

TIA

cheers
Howard
 
I don't know the solution to your problem apart from doing it with specific code to select the correct entry.


As it seems you are still on early stages of your development I suggest you search for "bound controls versus unbound"
You will find plenty of threads explaning the reasons why you should stay away from bound controls.

but mainly with Data bound controls you don't have much control over them, and on how they behave with your data.
With code you have full control over when and how you data gets from/to the database.





Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top