?
Solved

Filliing MSFlexgrid

Posted on 2003-03-31
6
Medium Priority
?
370 Views
Last Modified: 2012-08-13
in the following code I want to fill MSFlexGrid1 by the recordset (RS) data but it gives me error.

Private Sub Form_Load()
RS.Close
RS.open "Select * from Table1"
Me.MSHFlexGrid1.DataSource = RS
End Sub

Feel free to suggest and ammend this code to fill MSFlexGrid1 by the recordset data using SQL statements.

Note: I have already defined and opened the RS and ADODB connection in another lines in my project.

Thanx

0
Comment
Question by:asns
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 11

Expert Comment

by:supunr
ID: 8242153
Private Sub Form_Load()
RS.Close
RS.open "Select * from Table1"
Set Me.MSHFlexGrid1.DataSource = RS
End Sub
0
 
LVL 1

Expert Comment

by:sazhagianambi
ID: 8243066
Hi,

Tryout This,

RS.open "Select * from Table1"
'MSHFlexGrid1.clear
Set MSHFlexGrid1.Recordset = RS

Regards,
Nambi




0
 

Expert Comment

by:tsravank
ID: 8243439
   rs.Open "<Query>", cn2, adOpenStatic
    rs.MoveLast
    rs.MoveFirst
        detgrid.Rows = rs.RecordCount + 1
        detgrid.Cols = rs.Fields.Count
        For i = 1 To rs.RecordCount
            For j = 0 To rs.Fields.Count - 1
                detgrid.TextMatrix(i, j) = rs.Fields(j).Value
            Next j
            rs.MoveNext
        Next
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:rinkujain
ID: 8243703
You can solve your purpose by following way :

Private Sub Form_Load()
MSHFlexGrid1.rows=2
i=1
While RS.EOF <> True
       MSHFlexGrid1.TextMatrix(i, 0) = i
       msfxopt.TextMatrix(i, 1) = RS.Fields(0)
       MSHFlexGrid1.TextMatrix(i, 2) = RS.Fields(1)
       ------------------
       -----------
       RS.movenext
        i = i + 1
        msfxopt.Rows = msfxopt.Rows + 1
       ''if you want only 16 rows display at a time in your grid then give following code

        If MSHFlexGrid1.Rows < 16 Then
          MSHFlexGrid1.Height = MSHFlexGrid1.Height + MSHFlexGrid1.CellHeight
        End If
       MSHFlexGrid1.Rows = MSHFlexGrid1.Rows - 1
Wend
end sub
Hope this may help you
0
 

Accepted Solution

by:
toni2002 earned 300 total points
ID: 8244006
this will do it

Private Sub Form_Load()
RS.Close
RS.open "Select * from Table1"
Set Me.MSHFlexGrid1.DataSource = RS
End Sub

use MSHFlexGrid for ADO
use MSFlexGrid for DAO
0
 

Expert Comment

by:go2abdul
ID: 8244284
where is the followup for ur question? the above suggesstion working with u or not.
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
Suggested Courses
Course of the Month11 days, 18 hours left to enroll

752 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