Print Currency in right alignment

I have a VB6 Developers version where the Data Environment is not fullly developed. So I cannot use the reports object... I need to use the Printer object to print data from an access recordset (from data.control on a form). Some fields are text and boolean and others are currency. The currency should be printed to the Printer Object with right alighnment.
FormatCurrency() gives only left alighned output. What can do? I thought of creating a function which takes the amount and "prints" given amount from right to left. Any other options?
ulrikehauptAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ulrikehauptAuthor Commented:
Edited text of question.
0
danlevansCommented:
Is this what you need?

ans$ = "$" & trim(format(urvalue, "##,##0.00")
0
ulrikehauptAuthor Commented:
Sorry the #'s do not keep a place open for unused digits (even if Microsoft claims it!). The values go beyond millions at times and the customer wants the amounts printed with cents righ aligned. Whe I use Format(valuestring, "000,000,000.00") I get 0's at the beginning and with #'s the amount aligns left to the $ sign.
Ulrike
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

AnswerTheManCommented:
convert it to string. shape the string as you like then send to printer.
0
ventondCommented:
Use the function below just like format
a = "$" & zformat(number, "ZZZ,ZZZ,ZZ0.00")

Public Function ZFormat(vNumber As Variant, sFormat As String) As String
' pvNumber can be any type that the Format() function can accept
'   ie. Integer, Single, String...
' This routine suppresses leading zeros while also leaving column formatting alone
' The VB Format routine '#' char will put nothing instead of space,
' destroying column spacing
    Dim sHold As String
    Dim iLoop As Integer

    sHold = Format$(vNumber, sFormat)
    For iLoop = 1 To Len(sHold)
        If Mid$(sHold, iLoop, 1) = "(" Or Mid$(sHold, iLoop, 1) = " " Then
            iLoop = iLoop + 1
        End If
        If Mid$(sHold, iLoop, 1) <> "0" And Mid$(sHold, iLoop, 1) <> "," Then
            Exit For
        Else
            If iLoop < Len(sHold) And Mid$(sHold, iLoop + 1, 1) = "." Then
                Exit For
            End If
            Mid(sHold, iLoop, 1) = " "
        End If
    Next
    ZFormat = sHold
End Function
0
ventondCommented:
Ooops make that "#"'s instead of "Z"'s.
0
ventondCommented:
Ooops make that "0"'s instead of "Z"'s.

Two mistakes in a row!
0
ulrikehauptAuthor Commented:
dear ventond
I'll try this in the morning (It's nearly midnight at my place now.)
I'll come back with the results
Ulrike
0
amebaCommented:
try this in debug window:
?Format$(Format$(1250, "0,000"), "@@@@@@@@@")
?Format$(Format$(1000250, "0,000"), "@@@@@@@@@")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mark2150Commented:
Use whatever format you want to build a string:

Printer.CurrentX = rightedgeintwips - Printer.TextWidth(CurrencyString)
Printer.Print CurrencyString

This is will give you right alligned text, formatting issues aside. For columnar work you should be using a monospaced font like Courier New.

M
0
ulrikehauptAuthor Commented:
I tried what ameba proposed in the comment above and it works just great.
Such elegant solutions apeal to me.
Ameba, please pass your coment as answer to enable me to get the points to you.
Ulrike
0
ulrikehauptAuthor Commented:
An elegant answer.
0
amebaCommented:
Thanks for your points.
0
ulrikehauptAuthor Commented:
You're welcome
Ulrike
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.