Solved

Populate Flexigrid

Posted on 2001-06-29
2
356 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now