DBGrid Bug ?? 
Author Message
 DBGrid Bug ??

Hi Everybody,

-----------------------------------------
Using VB5 Ent-SR3, Win95, Access97
-----------------------------------------

I use SQL to insert data from Table1 to Table2 and one of the
fields (Data1) needs to be divided by 1000.

    mySql = "INSERT INTO Table2 (Name,Data1) SELECT Name,Data1/1000 FROM

Table1;"
    dbs.Execute mySql
    Data1.Refresh

In Table2 field Data1 is formatted as Double with 2 decimal Places.
However DBGrid that is bound to Table2 using Data Control shows
3 decimal places (e.g 123456 becomes 123.456 instead of 123.46
that I am trying to get).

Funniest thing is when I open this table with MS Access all data is
in proper format -- 2 decimal places !!!

I looked through all properties of DBGrid and Data Control and can't
find anything that may cause the problem ?

I would appreciate Your Help or Advice !!!

Regards, Davie.



Mon, 04 Sep 2000 03:00:00 GMT
 DBGrid Bug ??

Try using the format command on your division.  I.E. something like
Format(Data/1000,999,990.00)

Scott.

Quote:

>Hi Everybody,

>-----------------------------------------
>Using VB5 Ent-SR3, Win95, Access97
>-----------------------------------------

>I use SQL to insert data from Table1 to Table2 and one of the
>fields (Data1) needs to be divided by 1000.

>    mySql = "INSERT INTO Table2 (Name,Data1) SELECT Name,Data1/1000 FROM

>Table1;"
>    dbs.Execute mySql
>    Data1.Refresh

>In Table2 field Data1 is formatted as Double with 2 decimal Places.
>However DBGrid that is bound to Table2 using Data Control shows
>3 decimal places (e.g 123456 becomes 123.456 instead of 123.46
>that I am trying to get).

>Funniest thing is when I open this table with MS Access all data is
>in proper format -- 2 decimal places !!!

>I looked through all properties of DBGrid and Data Control and can't
>find anything that may cause the problem ?

>I would appreciate Your Help or Advice !!!

>Regards, Davie.



Mon, 04 Sep 2000 03:00:00 GMT
 DBGrid Bug ??

Quote:

> ...
> I use SQL to insert data from Table1 to Table2 and one of the
> fields (Data1) needs to be divided by 1000.
>     mySql = "INSERT INTO Table2 (Name,Data1) SELECT Name,Data1/1000 FROM
> ...
> In Table2 field Data1 is formatted as Double with 2 decimal Places.
> However DBGrid that is bound to Table2 using Data Control shows
> 3 decimal places (e.g 123456 becomes 123.456 instead of 123.46
> that I am trying to get).
> Funniest thing is when I open this table with MS Access all data is
> in proper format -- 2 decimal places !!!
> I looked through all properties of DBGrid and Data Control and can't
> find anything that may cause the problem ?

If Table1.Data1 is an integer (you don't say, so I'll just
assume) then it's not too surprising that Data1/1000 is going
to, in general, have three significant digits after the decimal
point. Consequently it's not too surprising that the data
control that you've attached to it is going to show this. You
should, rather than look at the properties of the data control,
look at the properties of the column (in Table2) in question.
From what you say, you have it set to show two decimal places.
The number, however, is stored as accurately as it can be.
It's up to you how it's displayed.

Quote:
> ...

--
Paul Sampson____Principal Consultant Onyx Systems______Onyx Internet
Zetland Buildings__Exchange Square__Middlesbrough__TS1 1DE__UK 33711 \\/+

PGP:BB74A4EF 03F844C1 F375FEC6 7EF96E43    http://tradezone.onyx.net >--<


Tue, 05 Sep 2000 03:00:00 GMT
 DBGrid Bug ??

Thanks for Your Help Scott,

I tried that and it wouldn't insert any data at all -----
I don't think this is a problem with formatting of the
number ----

My understanding is that DBGrid and Data Control that
I use should simply display data from the table -----
And in the table all data has 2 decimal places !!!

Any ideas ??

Regards, Davie.

Quote:

> Try using the format command on your division.  I.E. something like
> Format(Data/1000,999,990.00)

> Scott.


> >Hi Everybody,

> >-----------------------------------------
> >Using VB5 Ent-SR3, Win95, Access97
> >-----------------------------------------

> >I use SQL to insert data from Table1 to Table2 and one of the
> >fields (Data1) needs to be divided by 1000.

> >    mySql = "INSERT INTO Table2 (Name,Data1) SELECT Name,Data1/1000 FROM

> >Table1;"
> >    dbs.Execute mySql
> >    Data1.Refresh

> >In Table2 field Data1 is formatted as Double with 2 decimal Places.
> >However DBGrid that is bound to Table2 using Data Control shows
> >3 decimal places (e.g 123456 becomes 123.456 instead of 123.46
> >that I am trying to get).

> >Funniest thing is when I open this table with MS Access all data is
> >in proper format -- 2 decimal places !!!

> >I looked through all properties of DBGrid and Data Control and can't
> >find anything that may cause the problem ?

> >I would appreciate Your Help or Advice !!!

> >Regards, Davie.



Tue, 05 Sep 2000 03:00:00 GMT
 DBGrid Bug ??

Thanks for Your Help, Paul !

Both fileds have the same format ----- Double with 2 decimal Places --

Both fields show data w/2 decimal places when opened with Access.
If you have a chance try duplicate it -- I wonder if you'll get the same
result !

Thanks again, Davie.

Quote:


> > ...
> > I use SQL to insert data from Table1 to Table2 and one of the
> > fields (Data1) needs to be divided by 1000.

> >     mySql = "INSERT INTO Table2 (Name,Data1) SELECT Name,Data1/1000 FROM

> > ...
> > In Table2 field Data1 is formatted as Double with 2 decimal Places.
> > However DBGrid that is bound to Table2 using Data Control shows
> > 3 decimal places (e.g 123456 becomes 123.456 instead of 123.46
> > that I am trying to get).

> > Funniest thing is when I open this table with MS Access all data is
> > in proper format -- 2 decimal places !!!

> > I looked through all properties of DBGrid and Data Control and can't
> > find anything that may cause the problem ?

> If Table1.Data1 is an integer (you don't say, so I'll just
> assume) then it's not too surprising that Data1/1000 is going
> to, in general, have three significant digits after the decimal
> point. Consequently it's not too surprising that the data
> control that you've attached to it is going to show this. You
> should, rather than look at the properties of the data control,
> look at the properties of the column (in Table2) in question.
> From what you say, you have it set to show two decimal places.
> The number, however, is stored as accurately as it can be.
> It's up to you how it's displayed.

> > ...

> --
> Paul Sampson____Principal Consultant Onyx Systems______Onyx Internet
> Zetland Buildings__Exchange Square__Middlesbrough__TS1 1DE__UK 33711 \\/+

> PGP:BB74A4EF 03F844C1 F375FEC6 7EF96E43    http://tradezone.onyx.net >--<



Tue, 05 Sep 2000 03:00:00 GMT
 DBGrid Bug ??

Thanks a lot ----

Works great !!!

Regards, Davie.

Quote:

> try this
> 1. select the dbgrid in the form view window ... note the dbgrid hould be
> abound data grid
> 2. right click and choose retrieve fields
> 3.right click and choose properties
> 4.click on columns tab
> 5.click on column combobox
> 6.choose column?(data1)  .... or whichever field you wish to format
> 7.set numberformat combobox to fixed

> then run the project

> best of luck
> -cg


> >Thanks for Your Help Scott,

> >I tried that and it wouldn't insert any data at all -----
> >I don't think this is a problem with formatting of the
> >number ----

> >My understanding is that DBGrid and Data Control that
> >I use should simply display data from the table -----
> >And in the table all data has 2 decimal places !!!

> >Any ideas ??

> >Regards, Davie.



Tue, 05 Sep 2000 03:00:00 GMT
 DBGrid Bug ??

try this
1. select the dbgrid in the form view window ... note the dbgrid hould be
abound data grid
2. right click and choose retrieve fields
3.right click and choose properties
4.click on columns tab
5.click on column combobox
6.choose column?(data1)  .... or whichever field you wish to format
7.set numberformat combobox to fixed

then run the project

best of luck
-cg

Quote:

>Thanks for Your Help Scott,

>I tried that and it wouldn't insert any data at all -----
>I don't think this is a problem with formatting of the
>number ----

>My understanding is that DBGrid and Data Control that
>I use should simply display data from the table -----
>And in the table all data has 2 decimal places !!!

>Any ideas ??

>Regards, Davie.



Wed, 06 Sep 2000 03:00:00 GMT
 
 [ 7 post ] 

 Relevant Pages 

1. DBGrid Bug sample code here

2. Borlands DBGrids bug - New work arounds

3. Access 2000, Dao 3.6 & dbgrid bug

4. Is it DBgrid Bug?????????

5. dbgrid bug!! causes GPF in dbgrid16.ocx - HELP

6. DBGRID Bug, can't enter text after a dialog lookup...

7. BUGS idapi BUGS idapi BUGS idapi BUGS

8. Bug in DBGrid

9. scrollbar in TDBLookupCombobox (was: DBgrid: scrollbar bug?)

10. Bug using DBGrid w/ Menu Designer?

11. DBgrid: scrollbar bug?

12. Bug in DBGrid for D4??


 
Powered by phpBB® Forum Software