Solved

MS FlexGrid

Posted on 2001-06-15
8
146 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

759 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

22 Experts available now in Live!

Get 1:1 Help Now