Results 1 to 7 of 7

Thread: Populate Grids

  1. #1
    Join Date
    May 2004
    Location
    Ohio
    Posts
    61

    Unanswered: *Resolved* please delete

    Hi all, I have a form with 3 Grids on it. The first populates a table. The second populates info dependent on which item i click on in Grid 1 and the Third Grid populates info dependent on Grid 2. I'm not quite sure how I go about coding this, so if anyone can point me in the right direction, I'd really appreciate it.

    Thank you!
    Last edited by Smitty81; 11-30-04 at 14:49.

  2. #2
    Join Date
    Nov 2004
    Posts
    108

    Exclamation Data Form Wizard

    if your are looking for a short cut search on Heriarchical Recordsets and Shape(ADO) and take a look at how the Data Form Wizard handles Heriarchical Recordsets
    to err is human ; to really mess things up requires a computer

  3. #3
    Join Date
    May 2004
    Location
    Ohio
    Posts
    61
    I've searched and can't find anything. I just want the last 2 grids to filter based on what I click on the first Grid. Sounds simple enough but I just can't figure it out.

  4. #4
    Join Date
    Nov 2004
    Posts
    108

    Exclamation Msdn

    if you have MSDN you just have to go the help\Index and type Shape and you'll see the complet format for shape

    but you can first use the wizard you may create a new project and select the vb application wizard and create an application with the 2 grids you want or with a MShflexgrid or in your existing project in the Add-Ins\add-ins manager select the Data form Wizard and check on the Load Behavior the first two options and then go to add-ins\data form wizard and create a form with the hierachical recordset and then look at the code generated


    MSDN
    Displaying Hierarchical Recordsets
    A major feature of the MSHFlexGrid control is its ability to display hierarchical recordsets—relational tables displayed in a hierarchical fashion. The easiest way to create a hierarchical recordset is to use the Data Environment designer and assign the DataSource property of the MSHFlexGrid control to the Data Environment. You can also create a hierarchical recordset in code using a Shape command as the RecordSource for an ADO Data Control, as shown in the example below:

    Code:
    ' Create a ConnectionString.
    Dim strCn As String
    strCn = "Provider=MSDataShape.1;Data Source=Nwind;" & _
    "Connect Timeout=15;Data Provider=MSDASQL"
    
    ' Create a Shape command.
    Dim strSh As String
    strSh = "SHAPE {SELECT * FROM `Customers`}  AS Customers " & _
    "APPEND ({SELECT * FROM `Orders`}  AS Orders RELATE " & _
    "CustomerID TO CustomerID) AS Orders"
    
    ' Assign the ConnectionString to an ADO Data Control's
    ' ConnectionString property, and the Shape command to the 
    ' control's RecordSource property.
    With Adodc1
       .ConnectionString = strCn
       .RecordSource = strSh
    End With
    ' Set the HflexGrid control's DataSource property to the 
    ' ADO Data control.
    Set HFlexGrid1.DataSource = Adodc1
    to err is human ; to really mess things up requires a computer

  5. #5
    Join Date
    May 2004
    Location
    Ohio
    Posts
    61
    Thanks for replying. For whatever reason, MSDN wasn't installed. I get all 3 grids to populate fine. My problem is getting the other 2 grids to filter based on the record I select in Grid 1.

  6. #6
    Join Date
    Nov 2004
    Posts
    108

    Lightbulb Private Sub object_SelChange()

    see if your object has an SelChange event or something similar (as selected) thatOccurs when the selected range changes to a different cell or range of cells and take the value of the cell as a parameter to fill the other grids
    to err is human ; to really mess things up requires a computer

  7. #7
    Join Date
    May 2004
    Location
    Ohio
    Posts
    61

    Smile

    Thanks, turns on my on click() coding was all wrong. Thanks for shedding some light!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •