Data Display problem in MSFELXGRID Table


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Data Display problem in MSFELXGRID Table

  1. #1
    Muhammad Waqas Guest

    Data Display problem in MSFELXGRID Table


    Dear All

    I'm just displaying the data in MSFlexGrid Table of MS Access 2000 database.
    One of the column has the following attributes:

    Data Type: Number
    Field Size: Single
    Format: Fixed
    Decimal Places: 2

    The following table shows the problem:

    Actual Value Display in MSFLEXGRID
    7 7
    7.1 7.0999998
    7.2 7.1999998
    7.3 7.3000002
    7.5 7.5
    8 8
    11 11

    Best Regards

    Muhammad Waqas


  2. #2
    marc Guest

    Re: Data Display problem in MSFELXGRID Table


    I just saw good response to this in the VB general discussion group (Rounding
    Question). A similiar situation is occurring here. Access is not storing
    the number correctly. Push the decimal place up to 7 and you will see the
    same number. A work around is to format the data in the query before populating
    the flexgrid. ex instead of column [number] have column rounded_number:
    format([number],2). I ran into major problems with this on an application
    that used both rounding and significant figures.

    Marc

    "Muhammad Waqas" <mwaqas@i2cinc.com> wrote:
    >
    >Dear All
    >
    >I'm just displaying the data in MSFlexGrid Table of MS Access 2000 database.
    >One of the column has the following attributes:
    >
    >Data Type: Number
    >Field Size: Single
    >Format: Fixed
    >Decimal Places: 2
    >
    >The following table shows the problem:
    >
    >Actual Value Display in MSFLEXGRID
    >7 7
    >7.1 7.0999998
    >7.2 7.1999998
    >7.3 7.3000002
    >7.5 7.5
    >8 8
    >11 11
    >
    >Best Regards
    >
    >Muhammad Waqas
    >



  3. #3
    Muhammad Waqas Guest

    Re: Data Display problem in MSFELXGRID Table


    Hi Marc

    The problem is that I'm simply pass the recordset to the flexgrid as following:

    Set MSHFlexGrid.DataSource = datPrimaryRS

    As u described do i need to pass the data to MSHFlexGrid row by row it slow
    down the process. Does there is any way other? I mean to say instead to pass
    row by row simply pass the Recordset.

    Best Regards

    Muhammad Waqas

  4. #4
    marc Guest

    Re: Data Display problem in MSFELXGRID Table


    What I was talking about was the query that datPrimaryRS is using for a record
    source. If it is using a table as a record source I would change it to a
    query. Then in the Access query designer change the column that selects
    the number to rounded_number(format([number], "0.00"). I did give you the
    wrong for format string, I mixed up round and format functions, I really
    need to proof these posts, sorry.

    Marc

    "Muhammad Waqas" <mwaqas@i2cinc.com> wrote:
    >
    >Hi Marc
    >
    >The problem is that I'm simply pass the recordset to the flexgrid as following:
    >
    > Set MSHFlexGrid.DataSource = datPrimaryRS
    >
    >As u described do i need to pass the data to MSHFlexGrid row by row it slow
    >down the process. Does there is any way other? I mean to say instead to

    pass
    >row by row simply pass the Recordset.
    >
    >Best Regards
    >
    >Muhammad Waqas



  5. #5
    Join Date
    Dec 2005
    Posts
    1
    Found a really easy way to do this.

    assign the recordset to the datagrid, the run a for statement down each of the row with the problem and set the text of each one to the value from the recordset.
    This works because the value in the recordset is correct, and for my example was only 2 decimal places long.

    It also means that you don't have to use the Rounding functioin, nor the Format function. Therefore is quick as no conversion is done.
    -----
    Set rsLabour = adoJobs.Recordset
    Set HGridLabour.DataSource = rsLabour 'important to do this before running the following

    For i = 1 To rsLabour.RecordCount
    HGridLabour.Col = 7 ' Sets the column you wish to change
    HGridLabour.Row = i ' Sets the row you wish to change
    HGridLabour.Text = rsLabour.Fields(7).Value 'Sets the Text Property to the recordset value.
    rsLabour.MoveNext
    Next i

    adoJobs.Recordset.Close
    Set rsLabour = Nothing
    -----
    Quote Originally Posted by marc
    What I was talking about was the query that datPrimaryRS is using for a record
    source. If it is using a table as a record source I would change it to a
    query. Then in the Access query designer change the column that selects
    the number to rounded_number(format([number], "0.00"). I did give you the
    wrong for format string, I mixed up round and format functions, I really
    need to proof these posts, sorry.

    Marc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center