Format combined numbers as a number

R

rbeach

Please let me know what is wrong with the formula below used in a query
field. I need to cobine two number fields , PanelID and CircuitID and have
the result formatted as a number. This is formatting as text.

FullCircuitID: CStr(Format([Panel]![PanelID] & [Circuit]![CircuitID],"00"))
 
S

Stuart McCall

rbeach said:
Please let me know what is wrong with the formula below used in a query
field. I need to cobine two number fields , PanelID and CircuitID and have
the result formatted as a number. This is formatting as text.

FullCircuitID: CStr(Format([Panel]![PanelID] &
[Circuit]![CircuitID],"00"))

Remove the surrounding Cstr code, including the relevant parens. This is
converting the result to a string.
 
R

rbeach

My apologies, once I sent this I noticed I left the CStr in which makes the
difference.
 
S

Stuart McCall

rbeach said:
My apologies, once I sent this I noticed I left the CStr in which makes
the
difference.

--
Rick


rbeach said:
Please let me know what is wrong with the formula below used in a query
field. I need to cobine two number fields , PanelID and CircuitID and
have
the result formatted as a number. This is formatting as text.

FullCircuitID: CStr(Format([Panel]![PanelID] &
[Circuit]![CircuitID],"00"))

I'm going to presume you meant to say 'which makes no difference'. And it
won't. On further thought (rather than a quick glance), the problem is that
you want the number left-padded with zero - which then is not a number. Do
you want this so that your numbers line up in tabular lists? If so, use a
continuous form to display the list, and set the Text Align property of the
relevant control to Right aligned.
 
R

rbeach

I need this to be a formula for a column in a query. This query is used for
other queries That compare this number to other tables that are formatted as
numbers.

I have also tried utilizing "nn" in place of the "00" but it only gives the
result of the number 00 for all results in that column rather than the two
correct numbers concatenated and formatted as a number.

--
Rick


Stuart McCall said:
rbeach said:
My apologies, once I sent this I noticed I left the CStr in which makes
the
difference.

--
Rick


rbeach said:
Please let me know what is wrong with the formula below used in a query
field. I need to cobine two number fields , PanelID and CircuitID and
have
the result formatted as a number. This is formatting as text.

FullCircuitID: CStr(Format([Panel]![PanelID] &
[Circuit]![CircuitID],"00"))

I'm going to presume you meant to say 'which makes no difference'. And it
won't. On further thought (rather than a quick glance), the problem is that
you want the number left-padded with zero - which then is not a number. Do
you want this so that your numbers line up in tabular lists? If so, use a
continuous form to display the list, and set the Text Align property of the
relevant control to Right aligned.
 
S

Stuart McCall

rbeach said:
I need this to be a formula for a column in a query. This query is used for
other queries That compare this number to other tables that are formatted
as
numbers.

I have also tried utilizing "nn" in place of the "00" but it only gives
the
result of the number 00 for all results in that column rather than the two
correct numbers concatenated and formatted as a number.

--
Rick


Stuart McCall said:
rbeach said:
My apologies, once I sent this I noticed I left the CStr in which makes
the
difference.

--
Rick


:

Please let me know what is wrong with the formula below used in a
query
field. I need to cobine two number fields , PanelID and CircuitID and
have
the result formatted as a number. This is formatting as text.

FullCircuitID: CStr(Format([Panel]![PanelID] &
[Circuit]![CircuitID],"00"))

I'm going to presume you meant to say 'which makes no difference'. And it
won't. On further thought (rather than a quick glance), the problem is
that
you want the number left-padded with zero - which then is not a number.
Do
you want this so that your numbers line up in tabular lists? If so, use a
continuous form to display the list, and set the Text Align property of
the
relevant control to Right aligned.

Hmm. I haven't run across this one before. One thing you could try is to set
the formula to be just the concatenation, and set the Format property of the
column to (say) General Number.

When you say that it is formatting as text, how are you determining this?
 

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