Carrying Out Decimals

G

Guest

Hello,

I have a query that pulls back data through a SQL connection from another
data base that I do not control where the values are shown as two decimals
like 4.47 What I need to do is display this number as .0447 How can I
change the query to carry out the decimals to 4 places? Thanks
 
J

Jeff Boyce

I'm not clear on something. Is the data that is stored in the other
database stored as "4.47", or is that how it is being displayed after you
retrieve it?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John Spencer

If the field is a number field then just divide by 100
[SomeField} / 100

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
G

Guest

Thank you both.

Yes Jeff, it is stored in the other table as 4.47 and I need to display it
as .0447.

John, where would this expression be placed in the query or in the report
from the query?

John Spencer said:
If the field is a number field then just divide by 100
[SomeField} / 100

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Novice2000 said:
Hello,

I have a query that pulls back data through a SQL connection from another
data base that I do not control where the values are shown as two decimals
like 4.47 What I need to do is display this number as .0447 How can I
change the query to carry out the decimals to 4 places? Thanks
 
J

John Spencer

You could do it in either place.

In the query, just add a new column or use the current one
Field: [TheFieldName]: [TheTableName].[TheFieldName]/100

In the control source for the control
Control Source: =[TheFieldName]/100

You will probably need to have an additional control bound to the field
name. You can set this additional control's visible property to No (false)
so it isn't visible. The reason for adding a control bound to the field is
that Access tends to drop fields from the report's source if they aren't
used by the report as the source for a control or as a source for sorting
and grouping dialogs.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Novice2000 said:
Thank you both.

Yes Jeff, it is stored in the other table as 4.47 and I need to display it
as .0447.

John, where would this expression be placed in the query or in the report
from the query?

John Spencer said:
If the field is a number field then just divide by 100
[SomeField} / 100

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Novice2000 said:
Hello,

I have a query that pulls back data through a SQL connection from
another
data base that I do not control where the values are shown as two
decimals
like 4.47 What I need to do is display this number as .0447 How can
I
change the query to carry out the decimals to 4 places? Thanks
 
G

Guest

Thank you John. Exactly what I needed!

John Spencer said:
You could do it in either place.

In the query, just add a new column or use the current one
Field: [TheFieldName]: [TheTableName].[TheFieldName]/100

In the control source for the control
Control Source: =[TheFieldName]/100

You will probably need to have an additional control bound to the field
name. You can set this additional control's visible property to No (false)
so it isn't visible. The reason for adding a control bound to the field is
that Access tends to drop fields from the report's source if they aren't
used by the report as the source for a control or as a source for sorting
and grouping dialogs.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Novice2000 said:
Thank you both.

Yes Jeff, it is stored in the other table as 4.47 and I need to display it
as .0447.

John, where would this expression be placed in the query or in the report
from the query?

John Spencer said:
If the field is a number field then just divide by 100
[SomeField} / 100

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Hello,

I have a query that pulls back data through a SQL connection from
another
data base that I do not control where the values are shown as two
decimals
like 4.47 What I need to do is display this number as .0447 How can
I
change the query to carry out the decimals to 4 places? Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top