Re: Currency conversion
- From: Steve Jensen <SteveJensen@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 10 Jun 2008 07:57:00 -0700
Thanks, Allen
I read your article and also found some code for assigning the property if
it does not exist. I agree that the way Access works with regard to currency
makes no sense unless you are sharing the database across regions and wish to
maintain the currency of the originating region, which is probably relatively
rare.
I have found that if you create the property per above or do not assign a
format at all with a currency field (blank out the Format property), it will
display per the regional currency settings in table view. If you blank out
the Format property on currency fields in form and report bound controls,
again it displays per regional settings.
This is great until you get to unbound controls (for displaying totals on
forms and reports). Then you have to set the format property to Currency in
code, which is a pain, but you have relatively fewer objects to maintain.
"Allen Browne" wrote:
Most objects in Access have only a limited number of properties, until you.
set them. If you test a field that has nothing in its Format property, you
get error 3270. But if the field does have something in its Format property,
it works.
That's why the previous reply concluded with the comment:
(using error recovery in case it does not exist.)
So, you need a piece of code that creates the property if it does not exist,
and sets it if it does. SetPropertyDAO() is what I use. You can copy it from
here:
http://allenbrowne.com/AppPrintMgtCode.html#SetPropertyDAO
As to what to set it to: set it manually to what you want. Then read the
property, and use that string as the target.
There is an additional trap to watch out for with the Currency format if
your users could have different regional settings:
http://allenbrowne.com/ser-44.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Steve Jensen" <SteveJensen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5A9601C7-2211-4909-B09C-10F1F0953EE6@xxxxxxxxxxxxxxxx
Allen, I have a function that loops through the properties of all the
fields
in a given table; however, 'Format' is not one of the properties. I would
very much like to give the user the option of globally changing the format
of
Currency fields to match their regional settings. It is easy if there is
a
property one can set; but I can't find it.
This lists all the properties of currency fields in a given table:
Debug.Print "Properties of fields in " & _
.TableDefs(stTable).Name & " table:"
For Each fldLoop In .TableDefs(stTable).Fields
If fldLoop.type = 7 Then 'currency field
Debug.Print i & ". " & fldLoop.Name
For Each fldProp In fldLoop.Properties
On Error Resume Next
Debug.Print fldProp.Name & " - " & fldProp.Value
Next fldProp
i = i + 1
End If
Next fldLoop
Format is not one of the properties, and if it was, I don't know what
value
to set for a format of Currency.
Can you help with this?
Thanks,
Steve
"Allen Browne" wrote:
It is possible to loop through the TableDefs, loop through the Fields of
the
TableDef to locate the numeric fields, and test the Format property
(using
error recovery in case it does not exist.)
"tedmi" <tedmi@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5C809210-9E88-438C-96ED-029BB3DDE2B5@xxxxxxxxxxxxxxxx
When you change the locale, every currency field's format gets changed
from
"Currency" to a custom format that includes the currency symbol of the
PREVIOUS locale. You have visit every currency field of every table to
set
the format to the new locale's currency symbol. Major BUMMER!
- References:
- Re: Currency conversion
- From: Steve Jensen
- Re: Currency conversion
- From: Allen Browne
- Re: Currency conversion
- Prev by Date: Re: Access 2003 Developer Extension
- Next by Date: RE: Need help with RecordSource and subform
- Previous by thread: Re: Currency conversion
- Next by thread: Re: Currency conversion
- Index(es):
Relevant Pages
|