Val of text with commas?

  • Thread starter Thread starter dlw
  • Start date Start date
D

dlw

I have some text numbers that have commas, like
"1,280" and "34,120" Val is stopping at the comma,
returning values of 1 and 34 for the above. Is there a
function that will return the real number?
Thank you.
 
Val(Replace([TextNumber], ",", "", 1, -1, vbTextCompare))

Use Replace function to delete the commas.
 
Sorry - forgot that you're using this in a query. Change vbTextCompare to
the number 1.

--

Ken Snell
<MS ACCESS MVP>

Ken Snell said:
Val(Replace([TextNumber], ",", "", 1, -1, vbTextCompare))

Use Replace function to delete the commas.

--
- - - - - - - - - - - - - - - - -
Ken Snell
<MS ACCESS MVP>

dlw said:
I have some text numbers that have commas, like
"1,280" and "34,120" Val is stopping at the comma,
returning values of 1 and 34 for the above. Is there a
function that will return the real number?
Thank you.
 
If in your Regional Settings, comma is the thousand
separator then you can use CLng to convert the String to
numeric value. For example (from Debug window):

?CLng("12,345")
12345

HTH
Van T. Dinh
MVP (Access)
 
Back
Top