Results 1 to 3 of 3

Thread: How To Populate MS Access Database Into MS Flexgrid ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Posts
    101

    Smile How To Populate MS Access Database Into MS Flexgrid ?

    Good day !

    How can I populate data in an Access database into the Flexgrid ?

    I have create a recordset , let say MyRecord, with all the data desired, but how i going to insert all of them into the flexgrid ?

    I tried refering to the MSDN explaination but I not really understand.

    I wonder how can I do that ?

    Thanks a lot !

    SonicWave

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Hi

    You will want something like the following ...



    VB Code:
    1. '---- open your recordset first (assuming open and adoRst as recordset variable)
    2.  
    3. msflex.clear 'meant to clear flex
    4. msflex.cols = 3 ' 3columns
    5. msflex.rows=0 ' clears flex
    6.  
    7. '---- sets column widths
    8. msflex.colwidth(0)=0
    9. msflex.colwidth(1)=1000
    10. msflex.colwidth(2)=1000
    11.  
    12. If adoRst.state=adStateOpen then
    13.   If Not adoRst.EOF Then
    14.     Do Until adoRst.EOF
    15.       lngCRow  = msflex.rows
    16.       msflex.add ""
    17.       msflex.textmatrix(lngCRow,0)=adorst("fieldID")
    18.       msflex.textmatrix(lngCRow,1)=adorst("Fielddata1")
    19.       msflex.textmatrix(lngCRow,2)=adorst("Fielddata2")
    20.       adoRst.MoveNext
    21.     Loop
    22.   End If
    23.   adoRst.Close
    24. End If

    NOTE: There is no checking on this for whether the recordset value is null, and there should be as it could error on that.


    Essentially thats it.

    Regards

    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Posts
    101

    Thanks ! I Can Get Your Idea !

    Good day !

    Thanks a lot for the code !

    I got some idea in it already.

    I will try to experiemnt with it around and see.

    It should be ok for me now

    Thanks again

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