Format Problem

D

DS

I have a column in a Query that is giving me problems.

PRICE:
IIf([CDDiscountDP]=1,CCur([CDQuantity]*[CDDiscountAmount]),FormatPercent([CDDiscountPercent],2))

If CDDiscountDP =1 then the fiield is of a dollar amount otherwise its
Percentage. I'm just getting a regular number back.
Thanks
DS
 
M

Marshall Barton

DS said:
I have a column in a Query that is giving me problems.

PRICE:
IIf([CDDiscountDP]=1,CCur([CDQuantity]*[CDDiscountAmount]),FormatPercent([CDDiscountPercent],2))

If CDDiscountDP =1 then the fiield is of a dollar amount otherwise its
Percentage. I'm just getting a regular number back.


A field (column) in a query can only have a single type.
You are trying to make it a Currency type in sone records
and Text in others (the Format function always returns a
string). The resulting type of your ambiguous expression is
whatever Access/Jet guesses it should be, most likely Text).

Maybe you want the field to be formatted as text in both
cases??

PRICE:IIf(CDDiscountDP=1,FormatCurrency(CDQuantity*CDDiscountAmount,2),FormatPercent(CDDiscountPercent,2))
 
D

DS

Perfect, works great! Since this is for display only I just need it to
appear as such instead of it really being as such.
Thanks
DS
 

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

Similar Threads

Query iiF Woes 2
SQL ORDER BY 1
Sub-Query Problem 8
Function Returns 0 3
SQL Rowsource 1
Union Query Format 6
OPEN ARGS Trouble 2
Blank in Listbox 1

Top