Align decimals in text boxes?

K

Kate

Hi, I am displaying columns of data that are based upon numeric data,
using a custom number formats based upon the size of the number.
However, the field will display text if it is empty. See field
calculation below.

=IIf(IsNull([kg/j]),"NA",Format([kg/j],Switch([kg/j]>=100,"#,###,##0",
[kg/j]>=10,"#0.0",[kg/j]>=0.1,"0.0#",[kg/j]>=0.01,"0.00#",[kg/j]>=0.001,"0.000#",
[kg/j]>0.0001,"0.0000#",[kg/j]<0.0001,"Scientific")))

My problem is that I would like to align the columns by decimal,
rather than simply right, left, or center. Is there any way this is
possible???

Thank you,
Kate
 
M

MA

Kate said:
Hi, I am displaying columns of data that are based upon numeric data,
using a custom number formats based upon the size of the number.
However, the field will display text if it is empty. See field
calculation below.

=IIf(IsNull([kg/j]),"NA",Format([kg/j],Switch([kg/j]>=100,"#,###,##0",
[kg/j]>=10,"#0.0",[kg/j]>=0.1,"0.0#",[kg/j]>=0.01,"0.00#",[kg/j]>=0.001,"0.0
00#",
[kg/j]>0.0001,"0.0000#",[kg/j]<0.0001,"Scientific")))

My problem is that I would like to align the columns by decimal,
rather than simply right, left, or center. Is there any way this is
possible???

Thank you,
Kate

Hi Kate, use Space(len(YourField)-Yourfield) & Youfield


--
_ _
Ciao
MAssimiliano Amendola www.accessgroup.it
Cisa - Conferenza Italiana per Sviluppatori Access
Info: www.donkarl.com/it
 
M

MA

MA said:
Kate said:
Hi, I am displaying columns of data that are based upon numeric data,
using a custom number formats based upon the size of the number.
However, the field will display text if it is empty. See field
calculation below.

=IIf(IsNull([kg/j]),"NA",Format([kg/j],Switch([kg/j]>=100,"#,###,##0",
[kg/j]>=10,"#0.0",[kg/j]>=0.1,"0.0#",[kg/j]>=0.01,"0.00#",[kg/j]>=0.001,"0.0
00#",
[kg/j]>0.0001,"0.0000#",[kg/j]<0.0001,"Scientific")))

My problem is that I would like to align the columns by decimal,
rather than simply right, left, or center. Is there any way this is
possible???

Thank you,
Kate

Hi Kate, use Space(len(YourField)-Yourfield) & Youfield
opz
this result 0
Space(10- len(YourField)) & Youfield
better


--
_ _
Ciao
MAssimiliano Amendola www.accessgroup.it
Cisa - Conferenza Italiana per Sviluppatori Access
Info: www.donkarl.com/it
 
K

Kate

Massimiliano, thank you for answering, but I don't understand exactly
what you are saying to do. Could you please show me, using the actual
text box calculation I have shown?

Thanks again,
Kate
Kate said:
Hi, I am displaying columns of data that are based upon numeric data,
using a custom number formats based upon the size of the number.
However, the field will display text if it is empty. See field
calculation below.

=IIf(IsNull([kg/j]),"NA",Format([kg/j],Switch([kg/j]>=100,"#,###,##0",

[kg/j]>=10,"#0.0",[kg/j]>=0.1,"0.0#",[kg/j]>=0.01,"0.00#",[kg/j]>=0.001,"0.0
00#",

[kg/j]>0.0001,"0.0000#",[kg/j]<0.0001,"Scientific")))

My problem is that I would like to align the columns by decimal,
rather than simply right, left, or center. Is there any way this is
possible???

Thank you,
Kate


Hi Kate, use Space(len(YourField)-Yourfield) & Youfield
 
M

MA

Kate said:
Massimiliano, thank you for answering, but I don't understand exactly
what you are saying to do. Could you please show me, using the actual
text box calculation I have shown?

Thanks again,
Kate

let me try to understand you calculation
=IIf(IsNull([kg/j]),"NA",
Format([kg/j],
Switch([kg/j]>=100,"#,###,##0",
[kg/j]>=10,"#0.0",
[kg/j]>=0.1,"0.0#",
[kg/j]>=0.01,"0.00#",
[kg/j]>=0.001,"0.000#",
[kg/j]>0.0001,"0.0000#",
[kg/j]<0.0001,"Scientific")))

Let me do a purpose.
If you have this fuction
Function fctRound(varNr As Variant, Optional varPl As Integer = 2) As Double
'by Konrad Marfurt + ("" by) Luke Chung + Karl Donaubauer
If Not IsNumeric(varNr) Then Exit Function
fctRound = Fix("" & varNr * (10 ^ varPl) + Sgn(varNr) * 0.5) / (10 ^
varPl)
End Function

You can have the value rounded and doubled

So you combo taht accept 15 characters (for example) must have
Space(15-len(nz(fctround(Kg/j);"NA")-nz(fctround(Kg/j);"NA")
So you put so many space before you calcoltion what
15 less the lenght of you calculation and obviously you calculation
with nz you have the case of null
Kate said:
Hi, I am displaying columns of data that are based upon numeric
data, using a custom number formats based upon the size of the
number. However, the field will display text if it is empty. See
field calculation below.

=IIf(IsNull([kg/j]),"NA",Format([kg/j],Switch([kg/j]>=100,"#,###,##0",

[kg/j]>=10,"#0.0",[kg/j]>=0.1,"0.0#",[kg/j]>=0.01,"0.00#",[kg/j]>=0.001,"0.0
00#",
[kg/j]>0.0001,"0.0000#",[kg/j]<0.0001,"Scientific")))

My problem is that I would like to align the columns by decimal,
rather than simply right, left, or center. Is there any way this is
possible???

Thank you,
Kate


Hi Kate, use Space(len(YourField)-Yourfield) & Youfield

--
_ _
Ciao
MAssimiliano Amendola www.accessgroup.it
Cisa - Conferenza Italiana per Sviluppatori Access
Info: www.donkarl.com/it
 
K

Kate

Thanks again. After studying the issue, I realized belatedly that
aligning the decimals would create a much wider field than I can use,
as I have several columns of such data already in a landscape report
and they barely fit as is. So thank you for your trouble, but I won't
be using this technique this time. Maybe it will be useful in the
future, however.

-Kate

Kate said:
Massimiliano, thank you for answering, but I don't understand exactly
what you are saying to do. Could you please show me, using the actual
text box calculation I have shown?

Thanks again,
Kate


let me try to understand you calculation
=IIf(IsNull([kg/j]),"NA",
Format([kg/j],
Switch([kg/j]>=100,"#,###,##0",
[kg/j]>=10,"#0.0",
[kg/j]>=0.1,"0.0#",
[kg/j]>=0.01,"0.00#",
[kg/j]>=0.001,"0.000#",
[kg/j]>0.0001,"0.0000#",
[kg/j]<0.0001,"Scientific")))

Let me do a purpose.
If you have this fuction
Function fctRound(varNr As Variant, Optional varPl As Integer = 2) As Double
'by Konrad Marfurt + ("" by) Luke Chung + Karl Donaubauer
If Not IsNumeric(varNr) Then Exit Function
fctRound = Fix("" & varNr * (10 ^ varPl) + Sgn(varNr) * 0.5) / (10 ^
varPl)
End Function

You can have the value rounded and doubled

So you combo taht accept 15 characters (for example) must have
Space(15-len(nz(fctround(Kg/j);"NA")-nz(fctround(Kg/j);"NA")
So you put so many space before you calcoltion what
15 less the lenght of you calculation and obviously you calculation
with nz you have the case of null

MA said:
Kate wrote:


Hi, I am displaying columns of data that are based upon numeric
data, using a custom number formats based upon the size of the
number. However, the field will display text if it is empty. See
field calculation below.

=IIf(IsNull([kg/j]),"NA",Format([kg/j],Switch([kg/j]>=100,"#,###,##0",
[kg/j]>=10,"#0.0",[kg/j]>=0.1,"0.0#",[kg/j]>=0.01,"0.00#",[kg/j]>=0.001,"0.0
00#",


[kg/j]>0.0001,"0.0000#",[kg/j]<0.0001,"Scientific")))

My problem is that I would like to align the columns by decimal,
rather than simply right, left, or center. Is there any way this is
possible???

Thank you,
Kate


Hi Kate, use Space(len(YourField)-Yourfield) & Youfield
 
M

MA

Kate said:
Thanks again. After studying the issue, I realized belatedly that
aligning the decimals would create a much wider field than I can use,
as I have several columns of such data already in a landscape report
and they barely fit as is. So thank you for your trouble, but I won't
be using this technique this time. Maybe it will be useful in the
future, however.

-Kate

Ok Kate, you are the boss

--
_ _
Ciao
MAssimiliano Amendola www.accessgroup.it
Cisa - Conferenza Italiana per Sviluppatori Access
Info: www.donkarl.com/it
 

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