Solved

MS FlexGrid

Posted on 2001-06-15
8
150 Views
Last Modified: 2010-05-02
I have designed a page which can be used to input employee details. I added a MSFlexGrid to that page,in which i wanted to add the records.

My problem is, after entering the record I will save that record. So, once it is saved it should display in that MSflexGrid. How  to do this????

I tried it is getting saved, but at the same time it is not appearing in MSFlexGrid. Once u close the program and then open the same u can find the saved record displayed in MSFlex.

So, what should I do, if I want to see my records in MSFlexGrid immediately when i saved a record.

....Ravi.
0
Comment
Question by:kudamala
[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
8 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6194458
There are a number of ways to do this. If you have a recordset bound to the flexgrid then after the new record has been added you will need to refresh the recordset and then reassign it to the flexgrid:

ADODC1.Refresh ' If using ADO Datacontrol
Data1.Refresh ' If using Intrinsic data control
Set MSFlexgrid1.DataSource = ADODC1 ' Or Data1 depending on data control in use.

This should redisplay the grid with the newly added record showing.
0
 
LVL 14

Expert Comment

by:puranik_p
ID: 6194685
Hoe about using a datagrid instead of MSFlexgrid?
keep it updatable and you don't have to write code for refreshing ADODC or the grid.
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6194688
If you are using, recordset, try:

rs.requery
(or)
re-open the recordset again.
and bind it to the MSHFlexGrid again.

You can also try like this for ADO Data Control:
ADODC1.Recordset.Requery

Cheers.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6194692
sorry, not MSHFlexGrid, its MSFlexGrid, right?
0
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 6194906
hi kudamala, MSFlexGrid control only compatible with intrinsic data control and remote data control such as Data Control and Remote Data Control (RDO), but not with ADODC.

You can pair MSFlexGrid with either Data Control or RDO by set its DataSource property.
0
 

Expert Comment

by:sureshpodaralla
ID: 6199385
Public Sub FlexiGridDisplay()

    ' Make room for column widths.
    num_cols = rst.Fields.Count
    ReDim col_wid(0 To num_cols - 1)

    ' Set column headerst.
    frmScan.flxResults.Rows = 2
    frmScan.flxResults.Cols = num_cols
    frmScan.flxResults.FixedCols = 0
    frmScan.flxResults.FixedRows = 1
    For c = 0 To num_cols - 1
       ' frmScan.flxResults.TextMatrix(0, c) = rst.Fields(c).Name
        frmScan.flxResults.TextMatrix(0, 0) = "Col1"
        frmScan.flxResults.TextMatrix(0, 1) = "col2"
        frmScan.flxResults.TextMatrix(0, 2) = "col3"
        frmScan.flxResults.TextMatrix(0, 3) = "col4"
        frmScan.flxResults.TextMatrix(0, 4) = "col5"
        frmScan.flxResults.TextMatrix(0, 5) = "col6"
        ' See if we need to enlarge the column.
        new_wid = frmScan.TextWidth(rst.Fields(c).Name)
        If col_wid(c) < new_wid Then col_wid(c) = new_wid
    Next c
    r = 0
    Do Until rst.EOF
        r = r + 1
        frmScan.flxResults.Rows = r + 1
        For c = 0 To rst.Fields.Count - 1
            ' if there is something in column
            If (Len(rst.Fields(c).Value)) Then
                frmScan.flxResults.TextMatrix(r, c) = rst.Fields(c).Value
                ' See if we need to enlarge the column.
                ' new_wid = Len(rst.Fields(c).Value)
                new_wid = frmScan.TextWidth(rst.Fields(c).Value)
            Else
                ' otherwise, use blank. if we don't do this
                ' it will die because of the invalid use of Null
                frmScan.flxResults.TextMatrix(r, c) = " "
                new_wid = 0
            End If
           
            ' Which ever is bigger that is going to be the new
            ' current col_wid(c)
           
            If col_wid(c) < new_wid Then col_wid(c) = new_wid
        Next c
        rst.MoveNext
    Loop
End If

    ' Set the grid's column widths.
    For c = 0 To num_cols - 1
        frmScan.flxResults.ColWidth(c) = col_wid(c) + 120
    Next

    ' Display the grid.
    frmScan.flxResults.Visible = True
   
    rst.Close
End Sub


I hope this will help you

Thanks,
suresh podaralla
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7136167
Hi kudamala@devx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept TimCottee's comment(s) as an answer.

kudamala@devx, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7173324
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 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