by Wayne Morg » Mon, 22 Nov 2004 06:19:36
In the Format event for the section (probably the Detail section of the
report) try:
Select Case Me.Currency_Code
Case "USD"
Me.Amount.Format = "$#,##0.00"
Case "JPY"
Me.Amount.Format = ",##0"
Case "KWD"
Me.Amount.Format = "#,##0.000"
Case Else
Me.Amount.Format = ""
Me.Amount = "Error"
End Select
If you don't want the currency symbols, just leave them out. I'm not sure
what the symbol is for the Korean money. Also, be aware that the Format may
round-off the numbers if there is data in more decimal places than you are
displaying.
--
Wayne Morgan
MS Access MVP
>> Hi
>> In the report there is
>> text coloumn "Currency_ code" (USD;JPY;KW)
>> and a column "Amount"
>> What i need is
>> If cuurency code is = "USD" amount format 5,840.00
>> if currency code is = "JPY" amount format 5,840
>> if currency code is = "KWD" amount format 5,840.000
>>
>> Record source for report data is from a query, where all amounts are
>> stored
>> as 5840.000.
>>
>> I AM WRITING A PROGRAME ON FOREIGN EXCHANGE, AND IT IS NOT ADVISABLE TO
>> DEFINE THE LOGIC ON ALL REPORTS. I NEED THIS INFORMATION BASED ON A
>> DATABASE
>> MAINTAINED FOR THIS PURPOSE WHERE ALL CURRENCIES AND ITS DECIMALS ARE
>> STORED.
>> e.g
>> curr decimals
>> usd 2
>> jpy 0
>> kwd 3
>>
>> Please help
>> Thanks
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> If they are in separate textboxes, then just set the Format property of
>>> each
>>> textbox. You won't be able to simply set if for Currency, because that
>>> will
>>> pick up the Currency settings from the Regional Settings in Control
>>> Panel.
>>> Instead, you'll have to define your own format.
>>>
>>> If they are all in one textbox, you'll need to do the same thing as
>>> mentioned above with one more detail. You'll need a field to indicate
>>> what
>>> the currency is, you'll then need to programmatically change the format
>>> of
>>> the textbox based on the value of the currency type field. This could be
>>> done in the Format event of the report's section that the textbox is in.
>>>
>>> Sample Formats:
>>> $0.00