convert or replace number using .(dot) for decimal to ,(comma)

G

Guest

there is a field that contains numbers using . for decimal so i need to
create a field that replace . (dot) to , (comma)
the numbers are like 3 not 3.00 or 3.1 not 3,1 or 3.01 not 3,01 so if there
are number without decimal does not present .
in this case i am using the follow query
UPDATE table SET table.field1 = Replace([field1],".",","), table.field2=
Replace([field2],".",",");
but i need to build a command without run that query
 
M

Michel Walsh

Hi,


Are you sure this is not simply a question of FORMATTING your number? if so,
your numbers are digitals, not strings, and the update is useless since the
table will revert the string to a digital representation (assuming the field
is numeric).


The Cultural (or Regional Setting) of your PC may asks to display a coma,
rather than a dot, for the decimal delimiter. It is considered to be hard on
the user to not respect his/her preference and to force, say, a US dot
delimiter when the user asks for a coma... Sure, that leads to some
interesting kind of bugs, mainly when you use automatic concatenation :

str= ".... " & floatingPointNumber & "..."



because, in:


".... myFunction( " & floatingPointNumber & " ) .... "


a coma will give TWO parameters to myFunction:


" ... myFunction( 0,5 ) ...."

while a dot will give just ONE:


" ... myFunction( 0.5 ) ... "



I don't know the whole story of your case, but be sure you don't use Replace
on a FORMATTED, but numerical, field.


Hoping it may help,
Vanderghast, Access MVP
 
G

Gary Walter

Evangelos Daflos said:
there is a field that contains numbers using . for decimal so i need to
create a field that replace . (dot) to , (comma)
the numbers are like 3 not 3.00 or 3.1 not 3,1 or 3.01 not 3,01 so if
there
are number without decimal does not present .
in this case i am using the follow query
UPDATE table SET table.field1 = Replace([field1],".",","), table.field2=
Replace([field2],".",",");
but i need to build a command without run that query

try looking at these:

http://groups.google.com/groups?lnk=hpsg&hl=en&q=Declare+Function+VariantChangeTypeEx
 

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