Solved

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

Posted on 2008-06-15
2
242 Views
Last Modified: 2013-11-27
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
Comment
Question by:angie_angie
2 Comments
 
LVL 6

Accepted Solution

by:
psychic_zero earned 500 total points
ID: 21791049
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 21791084
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access 2016 7 33
Dcount using a date in a table compared to today's date 3 27
Archiving Access table older than 6 months 9 37
Run SQL Server Proc from Access 11 27
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now