Solved

Populate Flexigrid

Posted on 2001-06-29
2
367 Views
Last Modified: 2008-02-01
I need to link a flexigrid to a datasource. has anyone got example code on how to do this?
0
Comment
Question by:krisjob
2 Comments
 
LVL 20

Expert Comment

by:hes
ID: 6239547
0
 
LVL 1

Accepted Solution

by:
edwinson earned 100 total points
ID: 6239560
Let's assume for the moment you have an ADO recordset. The included code gives you an example of how to connect a MSHflexgrid to an ADO recordset.
 
'First I set the fixed columns on my grid so the new
'data initially won't have a column of grayed out data
flxPerfTable.FixedCols = 0

'flxPerfTable - name of the MSHflexgrid
'rstPerf      - name of an ADO recordset containing
'               the desired data.
'
'next I use the set function of the flexgrid to assign
'a clone of a recordset to the grid. This loads the grid
'with the data.
'Basically you create a copy of the reference
'to the recordset.
Set flxPerfTable.DataSource = rstPerf.Clone

'Alternatively you can sometimes use
set flxPerfTable.DataSource = rstPerf

'In my code I have a column of record ID numbers that I
'want to be shaded gray so I reset the fixed columns to 1
flxPerfTable.FixedCols = 1


While this may get the data displayed in the grid you may want to do some additional formatting of column widths etc. to make sure the data can be viewed by your users in a way that makes sense.  Watch for data formatting as the flexgrid primarily handles text, so some data looks goofy when shown in the grid. In these cases you may need to modify the formatting of the data in the ADO prior to display. Experiment a bit.

Now if you haven't created an ADO recordset yet, you will need to do this as well before running the code above.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question