Combine two fields - retain formatting

L

lsgKelly

I have two fields - DedFam and DedSing. They are both Currency fields. I
need to combine the two with at "/" inbetween, so it would look like this:

$1,000/$2,000

Is there a way to combine the two and retain the current formatting? When I
combine them, it looks like this:

1000/2000.

Thank you for your help.
 
B

BruceM

It would have helped if you had described how you are combining them so that
there is a slash between the fields.

In general, if you are combining them in a query field:

CombinedAmount: "$" & [Field1] & "/$" & [Field2]

As the Control Source for an unbound text box:
= "$" & [Field1] & "/$" & [Field2]
 
J

John Spencer

You will need to use the VBA Format function

Format(DedFam,Currency) & "/" & Format(DedSing,Currency)


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
L

lsgKelly

BruceM said:
It would have helped if you had described how you are combining them so that
there is a slash between the fields.

In general, if you are combining them in a query field:

CombinedAmount: "$" & [Field1] & "/$" & [Field2]

Sorry I didn't explain better... but yes, I want this in a query as a
column called "Combined". This works great, but they want the commas, so it
looks like this: $2,000/$4,000.
As the Control Source for an unbound text box:
= "$" & [Field1] & "/$" & [Field2]


lsgKelly said:
I have two fields - DedFam and DedSing. They are both Currency fields. I
need to combine the two with at "/" inbetween, so it would look like this:

$1,000/$2,000

Is there a way to combine the two and retain the current formatting? When
I
combine them, it looks like this:

1000/2000.

Thank you for your help.
 
L

lsgKelly

John, thank you for the response. I tried this, and it didn't work. I'm
using this in a query, would that make a difference?
 
J

John Spencer

WHOOPS! Forgot the quote marks around Currency

Format(DedFam,"Currency") & "/" & Format(DedSing,"Currency")
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
L

lsgKelly

Okay, this is PERFECT...just one more question. It shows up like this:

$2,000.00/$4,000.00

Is there any way to get rid of the zeros after the decimal point?

Sorry to be such a pain. :)
 
L

lsgKelly

Nevermind, I fixed it with this:

CombinedAmount: Format([tDedSingle],"$#,###") & "/" &
Format([tDedFamily],"$#,###")

Thanks so much for all of your help!!!
 

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