Results 1 to 3 of 3

Thread: using the flexigrid control

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2000
    Posts
    81
    my code all works but i dont know how to display my query result in my flexigrid control
    Code:
    Private Sub Command1_Click()
    
    Dim dyna As Recordset
    Dim theError As Long
    Dim theid As Long
    
    
     theid = txtCandidateID
     SQL = "Select * from candidate  where candidateID = " & theid & "'"
    On Local Error Resume Next
    
    Set dyna = db.OpenRecordset(SQL, dbOpenDynaset, dbSQLPassThrough + dbSeeChanges)
    theError = Err
    On Local Error GoTo 0
    'what do i do next to get my query result into my 'flexigrid 'control???
    [/code]

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    Australia
    Posts
    82
    I'm not totally sure about FlexGrid, but the example below works for the older MS Grid (I thing FlexGrid is an improved version of this).

    You can use the .AddItem method to load text into cells, using the TAB character - Chr(9) - as the delimiter.

    For example, from your SQL Call, lets say you returned a recordset with the fields "This", "That" "TheOther". (based on your dyna recordset).

    with dyna
    'Populate recordset
    .movelast: .movefirst
    'Loop thru and add to Grid
    do while not .EOF
    MSFlexGrid.AddItem ![This] & chr(9) & ![That] & chr(9) & ![TheOther]
    .movenext
    end with

    You can use the .RemoveItem method to remove lines from the Grid.

    Hope this is of assistance.
    Adrian.

  3. #3
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    You can bind a FlexGrid to a data control on the form by setting it's DataSource property. However, the FlexGrid is generally crap and only displays read only records when you do finally get it to display them.
    Buy Apex TrueDBGrid (www.apexsc.com)

    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

Posting Permissions

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



Click Here to Expand Forum to Full Width