06-29-2000, 07:49 PM
I want to bind a recordset create online to Microsoft FlexGrid Control 6.0 dynamiclly through code, not through Data Control, how do I do that?
I'll be very appreciated for your help!
07-08-2000, 02:32 PM
i have done it and it works like a charm.The data control hassle is [censored].
So here u go i am sendin a .txt with some example of what and how...for more help email me or meet me on icq bet. 9-12 india time.
I am here to help and take some help in return.
11-22-2002, 03:15 PM
would have been helpful if you posted this for anyone else.....
11-22-2002, 03:38 PM
This my help, Chris
This will work with an Access DB. Replace with your own SQL statement. The FlexGrid Name is msh . I declaired sConn here, only for an example, It should be in a Module as Public , so it can be accessed from anywhere.
In your FormLoad Event call these procedures
Private Sub FillGrid()
'DECLAIR RECORDSET VARIABLES
Dim rs As ADODB.Recordset, sql As String, sConn As String
sConn = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" & App.Path & "\timecard.mdb;Persist Security Info=False"
'SELECT RECORDS IN LAST NAME FIRST NAME ORDER SO FLEX GRID WILL FILL CORRECTLY
sql = "SELECT Address.L_Name, Address.F_Name, Address.E_Address " _
& "FROM Address " _
& "ORDER BY L_Name"
'NEW ADODB RECORDSET
Set rs = New ADODB.Recordset
rs.Open sql, sConn, adOpenKeyset, adLockOptimistic, adCmdText
'SET FLEX GIRD DATA SOURCE TO THE RECORDSET
Set msh.DataSource = rs
msh.Visible = False
msh.Visible = True
'CLOSE AND CLEAR RS FROM MEMORY TO RECLAIM RESOURCES
Set rs = Nothing
Public Sub FormatGridAfter()
'FORMAT FLEX GRID HEADINGS AND COLUMN WIDTHS
.FormatString = "Last Name|First Name|Email Address"
.ColWidth(0) = 1520
.ColWidth(1) = 1520
Public Sub FormatGridBefore()
'FORMAT FLEX GRID TO 0
msh.FixedCols = 0
Hope this helps