Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

How to output a number in standard format while the number is varying in value

I want to write some code like this:
sSQL = "SELECT Format([OrderValue],'0,000.00') As Expr1 FROM..."
then open a recordset to write this value into a Word document.
The problem here is the value of OrderValue changes everytime.
If OrderValue = 500, in Word doc it will be 0,500.00 (extra 0 and comma)
If OrderValue = 4000000, in Word doc it will be 4000,000.00 (lack of one comma)
How to solve such problem?
0
angie_angie
Asked:
angie_angie
1 Solution
 
psychic_zeroCommented:
I expect you're using MS Access database. Maybe you can change 0 with # like this and see is it works:

sSQL = "SELECT Format([OrderValue],'#,###,###.00') As Expr1 FROM..."
0
 
Jeffrey CoachmanCommented:
angie_angie,

<open a recordset to write this value into a Word document>
If you just need to insert this value into a Word Document you can just store it as a Variable and insert it into the text.
Please explain why it must be in a recorrdset to be inserted into a Word Document?

JeffCoachman
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now