Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenation: Text and Numeric Values

Status
Not open for further replies.

FRIDL125

MIS
Mar 29, 2002
9
US
I'm wondering if the following is possible. I can't seem to find any supporting documentation on the Microsoft site.

I have a control that I am using to "create" a project description that (via concatenation) pulls together several fields... some of which are % and currency. I have my expression as follows...

=<this should be a percent> [IntroAPR] & &quot; Intro /&quot; & <this should be a percent> [FeePercent] & &quot; &quot; & <this should be currency> [MinFee] & &quot; Min &quot; & <this should be currency> IIf(IsNull([MaxFee]),&quot; No Max &quot;,IIf([MaxFee]=&quot;0&quot;,&quot; No Max &quot;,[MaxFee])) & &quot;(per transaction) /&quot; & <this should be a fixed number, no decimals> [BillingCycles] & &quot; Months /&quot; & &quot; Variable Prime + &quot; & <this should be a percent> [PrimePlus]

The result should be: &quot;0.00% Intro / 2% $29 Min $60 Max (per transaction) / 5 Months / Variable Prime + 10.74%&quot;

Can I format these fields using concatenation in a control on a form or report? OR do I need to create the illusion of concatenation by using individual controls and labels for extraneous text?

TIA
Lisa
 
Give the following a try. I don't have your exact controls and data but I think that this should be close to what you want. You may have to tweak the formating a bit but you are correct that you can cancatenate strings of literals and controls together as I have done below:

=Format([IntroAPR], &quot;00.0%&quot;) & &quot; INTRO /&quot; & Format([FeePercent], &quot;0%&quot;) & &quot; &quot; & Format([MiniFEE], &quot;$00&quot;)& &quot; Min &quot; & IIf(IsNull([MaxFee]),&quot; No Max &quot;,Format(IIf([MaxFee]=&quot;0&quot;,&quot; No Max &quot;,[MaxFee])), &quot;$0&quot;) & &quot;(per transaction) /&quot; & Format([BillingCycles],&quot;0&quot; & &quot; Months /&quot; & &quot; Variable Prime + &quot; & Format([PrimePlus], &quot;00.0%&quot;)

Let me know if anything doesn't look correct and we can help fix it.

Bob Scriver
 
Bob:

Thanks very much! This is exactly what I needed. I do have one follow up question...

In some cases, especially with the percentages, if the percent is 4.75% (for example) in one record, it may be 14.75% in another. How can I prevent the 4.75% from displaying as 04.75%?

TIA,
Lisa
 
You need to use the following:

=Format([IntroAPR], &quot;#0.0%&quot;)

# - is a place holder to display a number greater than 0.

Check out the Format Property in ACCESS Help. There are four links there for the different data types that will take you to the coding characters to assist you in formating numbers and currency, strings and memos, date/time, and Yes/No field types. On each of those pages there will be specific codes to use with those data types in conjunction with the Format function to format your data in any manner that choose.

Good Luck.

Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top