Solved

MS FlexGrid

Posted on 2001-06-15
8
147 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
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
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6194692
sorry, not MSHFlexGrid, its MSFlexGrid, right?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

863 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

25 Experts available now in Live!

Get 1:1 Help Now