Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Format A Label As Currency


I am trying to format a label as currency. The data is from a datasource and is formatted in the database as currency, but when the data shows on the form it is not formatted. How can I format this data to appear as currency when the form is printed or viewed at runtime?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Format Currency To Indian Format In Label/Textbox
Hi folks,
I am trying format the currency data in DB (Acs 2003) into Indian currency format 00,00,00,000 for which I used the below code

vbcode Code:
Me.lblAmt.Caption = Format(CCur(rsCurrent.Fields("suitAmount")), "##,##,##,##,##,##0")

but during display nothing happens i.e. the display continues to be the US format.
Can somebody show me how.
Thanks in advance.

Label And Currency Problem
I've set the DataFormat property of some labels to currency with 2 decimal places and I still get 3 digits after the decimal point. Can someone please help?

Currency Format Help Please
Hi

Please can someone help, I use the code below to enter numbers into a textbox, but i need the numbers in the textbox to be in a currency


Code:
Private Sub cmdNum_Click(index As Integer)
Select Case cmdNum(index).Caption
Case "0" To "9"
txtTender.SetFocus
txtTender.Text = Format(cmdNum(index).Caption, "Currency")
SendKeys cmdNum(index).Caption
End Select
If cmdNum(index).Caption = "." Then
txtTender.SetFocus
SendKeys "."
End If
End Sub
I have added the curency bit in but it only works for the first number pushed say for example if you push 65 the textbox displays $6,00 indtead of $65,00.

Please can someone tell me what i am doing wrong.

Many thanks

Currency Format
I have created a program with multiple check boxes. Each time a check box is selected I want it to add a currency amount of .50 to the second text box and then add the amount in the first text box to that of the second and populate the total in the third text box. The first time a check box is selected it is accurately showing the amount in the second box as a currency of $0.50 but does not total the amount into the third box. The second time a check box is selected it goes to .5 but this time it does total the third box. As subsequent check boxes are selected it is adding the numbers up accurately...but no longer showing them as currency. Please view the code below and let me know if you can see what I'm doing wrong.

Private Sub chkToppings_Click(Index As Integer)
If txtToppings.Text = "0.00" Then
txtToppings.Text = FormatCurrency(0.5, 2)
Else: txtToppings.Text = Val(txtToppings.Text) + FormatCurrency(0.5, 2)
txtTotal.Text = Val(txtPizza.Text) + Val(txtToppings.Text)
End If
End Sub

Thank YOU

Format Currency
Hi,

I have declared Vat as type Currency, and I am calculating Vat as 15% of an amount. Is there any function ar any way that I can round the Vat figure to 2 decimal places?

Thanks for any help

Z

Format Currency?
This what I tried but its not working


Code:
Private Sub txtCurFields_Click(Index As Integer)
Select Case txtCurFields(Index)
Case txtCurFields(0).Text
txtCurFields(0) = FormatCurrency(txtCurFields(0).Text)
Case txtCurFields(1).Text
txtCurFields(1) = FormatCurrency(txtCurFields(1).Text)
Case txtCurFields(2).Text
txtCurFields(2) = FormatCurrency(txtCurFields(2).Text)
End Select

End Sub

The array has many more textboxes ofcourse but this is what I am using to test it.

I want all of the fileds to format for currency

Oh and where should this be.. in the click or change or else where

vbMarkO

Currency Format
How do I set the Currency format to

3, 000

instead of 3000

I want a comma after 3 digits. If u know of a way to set it, please let me know. Thanks

Format Currency
Is there a way to format $20.00 to read "Twenty"

Format As Currency
Here is my code:


Code:
format$(strSomething, "Currency")


i am storing a number into a variable, and then i want to make that number come out as currency. However, i get an error saying that a = is required after the end parenthesis. I would guess that i cant format the value this way becuase it is in a variable (opposed to just putting in "########"). If thats the case i have no idea how to get it to work.

Format Currency.. Help
How do I make the outputs in the Captions for the Labels come out as Currency? Like $5.00 for example..
I tried adding FormatCurrency in front of the label name, but it did not work.
Thanks.


VB Code:
Private Sub cmdCalc_Click()   Const BurgerP As Currency = 1.25   Const FriesP As Currency = 1   Const DrinkP As Currency = 0.75   Const Tax As Currency = 0.08   Dim intBurgerQ As Integer   Dim intFriesQ As Integer   Dim intDrinkQ As Integer   Dim curTotalF As Currency   Dim curTax As Currency      intBurgerQ = Val(txtBurgerQuantity.Text)   intFriesQ = Val(txtFriesQuantity.Text)   intDrinkQ = Val(txtDrinkQuantity.Text)      lblTotBurger.Caption = intBurgerQ * BurgerP   lblTotFries.Caption = intFriesQ * FriesP   lblTotDrink.Caption = intDrinkQ * DrinkP      curTotalF = Val(lblTotBurger.Caption) + Val(lblTotFries.Caption) _   + Val(lblTotDrink.Caption) + Val(lblDeliveryCharge.Caption)      lblSubTotalDisplay.Caption = curTotalF   curTax = Val(curTotalF) * Tax   lblTaxDisplay.Caption = curTax      lblTotalDisplay.Caption = curTotalF + curTax End Sub

Currency Format
The user enter "1023.2" into a textbox. I want to use printer.print to get "$1023.20". How do I format so both the dollar sign and the zero is shown on the printout?

Format Decimal, Currency Like...
Frustrating, Looking for some serious fast help from anyone, thanks for any replys of help. My problem might be easier than I can see... What I have is a textbox with $0.00 and I want to be able to click any of the buttons, 1-0. When I click 1 for the first time I want the textbox to = $0.01, If I click button 1 again, next to = $0.11 and so on = $1.11 -> $11.11 -> $111.11, so I need to keep a format I guess, but I can't seem to get the format code to work. I been working with this for several hours, I didn't ask for help because I believed I could figure it out myself but seem to be stupidified. I know how to make the string continue... example textbox = textbox & "1" but next I need the format = "$0.00" Appreciate any help from people. Thanks

Zack

What Is The Format For Indian Currency?
Dear Friends,

What is the format for Indian Currency?
Say, for US format for currency : 200,000.00
and Indian currency format is like this : 2,00,000.00

txtCash.Text=Format, " ???? "

So, what is the format to be written for a txtbox?

Regards,

vblearner6

Currency Format In Different Region
how to get the currency format?

i mean in indonesian it's like this ex: 1.234.567,00
in US ex: 1,234,567.00

not sure in other countries

since i making a ConvertToText program but it fail when it met US region
if i code the possibilities then it wouldn't make sense since what if somewhere the format might like 1#234#567*00

hope u know what i mean

thx

Format Number As Currency
Alright now; this problem has been seriously bothering me.

I'm attempting to make something that displays an amount of money for every hour/minute/second worked.

It works, but the number I get has an obscene amount of numbers after the decimal point.

How do I format the number like a currencey?(USD)

so, that it's like #####.## with only two numbers after the decimal point?

Thanks in advance.
~R

RESOLVED Currency Format
I have a label on a form which is calculated from values in other text boxes, and im trying to format the total label into the currency format, but all its ends up printing in the label is "lblTotal.Caption" and not formatting the number

for Example




VB Code:
lblTotal.Caption = txtOne.Text + txtTwo.Text Format("lblTotal.Caption", "Currency")


what am i doing wrong?

Format Text Into Currency
What I want to do is format my text into $999, 999.99

I use format("txtbox.text", "Currency") which works when the values is less than $9999.99, but when I want a number say like 123456.78, it will give me $123456, w/ no decimals. I wanna be able to enter in dollars amounts less than a million and be able to format it like $999, 999.99

How is this done?

Thx.

How Format A Textbox For Currency
How to format a textbox for currency without using Maskedit Box. The only way at the moment is read the textbox and write back to the textbox with format function in the coding. This somehow creates some complication in the multiuser environment because the data is bound to a table.
Because it writes back to the textbox with the currency format "#,###,##0.00" it's actually changing the field.

Is it possible using API? Or is there any possible way where the format can be set and without have to use Maskedit or Richtextbox.

Please advise..

Thanking in advance

Currency Format And Validation
my application needs to allow user enter different currency, and I want to validate that currency code is a valid one, and format it as well.
an example:

if the user enters 100 and if the windows setting is USD, then it needs to display 100.00USD. if the user enters 100NZD, then I need to validate if NZD is a valid currency code, if it is, display it as 100.00NZD.

I looked at the format, FormatCurrency. but both seem to only use the windows setting for the currency. is there any built in function that parses a string, validates currency code, and reformat the string into currency format?

Thanks.

Format Flexgrid Column As Currency
Is it possible to format a flexgrid column to show as currency? Eg:$34.25 ?

Currency Format In Bound Textbox
Can someone help me out, I'm new to VB? I'm trying to currency format a db bound textbox. When I use "txtFields(3) = Format(txtFields(3).text, "Currency")" on a change event, I can't modify my data properly because it's triggered on the first keystroke.
I'm running vb5 and can't find any help on MS.

Thanks Thinker, the lostfocus event is good but formating does not appear on the form_load event. How can I trigger it to load with formats?

Database Grid: Currency Format
my dbgrid is not retriving the correct values of currency fields. If i put 3,50 euros it will retrieve 3 euros.

How Do You Convert Values Into Currency Format
i am using visual basic 6.0 and on one of my forms i need to do a calculation that calculates the difference between incomings and expenses-i have figured out this code and the code works fine

Heres the problem, at the moment in the textbox the user can enter anything, i want it so that the user can just enter numbers-and the textbox format will be currency-i dont know how this works-maybe when the user enters for example 100 this will automatically convert into (when the user goes to next textbox) £100.00-if there is a code for this please post below cuz i am really stuck-
here is the code i have at the moment

Private Sub cmdCalculate_Click()


txtProfit.Text = Val(txtIncomings.Text) - Val(txtOutgoings.Text)


If Val(txtProfit.Text) > 0 Then
txtProfit.ForeColor = vbGreen
Else
txtProfit.ForeColor = vbRed
End If

If Val(txtIncomings.Text) > Val(txtOutgoings.Text) Then
lblResult.Caption = "You made a profit!"
Else
lblResult.Caption = "You made a loss!"
End If

End Sub

Currency Display Format For A MaskEdBox
I have a MaskEdBox input field and i want to set it up so that only numbers can be enetered in the input box. No decimals or letters.


I think i need it in the key down action i think.....

Currency Format In Text Box (RESOLVED)
Hello everybody

I have this very simple question! How can I change the type of a text box to currency. E.t.c. I would like it to display a dollar or Euro sign after the amount is typed!

thx, in advance

George Papadopoulos

MSHFlexGrid Format A Column As Currency
I am just starting to use the MSHFlexGrid I'm used to the standard DataGrid so it was no problem formatting columns as currency so they showed as an example $4500.00. I'm trying to do the same with the MSHFlexGrid but it shows just 4500 not $4500.00. The db is Access and those fields are set to currency and the default is $0.00 in the db anyone know how to fix it??

Sorry I'm just stupid when it comes to the MSHFlexGrid.

Format Currency With Digit Decimal
Hello all,
  is there a format express or a way in visual basic 6.0 to format a value i.e. 100 = 100.00. no matter, what I try it always give me 100 and I want i to show as 100.00.

Thanks, Joe

How Do I Format A Numeric String As Currency?
i would like to take the string 54367 and make it $543.67
is there a function that will do this?

Format Cell To Currency - Error '1004'
Hi,

I'm trying to format a cell to currency once I've dropped the data on a sheet, but I get the following message: -

Run-time error '1004':

Unable to set the NumberFormat property of the Range class

This is the code I'm using: -


Code:
Cells(lngPosY, 4).NumberFormat = "Currency"
If I format it to a number i.e. '#,##0.00' it's fine.

Why is this error happening?

Regards

How Do I Add Numbers From Text Boxes In Currency Format?
I have 3 text boxes. I want to add text1 which is £3.00 to text 2 which is £4.00 and the answer to appear in text 3. However for some reason i cant perform this simple task. Please help. Thanx.

How To Format A Column In Data Grid As A Currency?
Hi, i have datagrid.
I want to format one of the column as a currnecy. Is it possible?
This is what i've done..but there's syntax error. Any idea?

Code:datagrid1.Columns(2).DataFormat = currency

thanx..

Format Currency Padded W/ Leading Blanks
I am trying to write a currency amount to at RichTextBox and format it like this:

My Input Data is the string: "00278144+"
I want it to display like this: "$__2,781.44" (where the underscores are actually blanks/spaces)

I've tried Format("00278144+", "$###,##0.00), but that doesn't seem to work.

Got hints?

Crystal Reports - Change Currency Format
I've designed some reports that will be used in different areas (Ireland & UK), so my VB app needs to be able to change the report currency format at run time.

I assume you're able to do this using the Crystal Automation Engine, does anyone know of any source for this - must be something that people do quite regularly!

Any links/code appreciated

Thanks

Need To Make My Labels Appear In A Currency Format And Display $ Sign So $0.00
What i need to do is that when i press add, i want the label to just display it in a currency format e.g. $0.00.

Ohk thats the code for my entire project, I think you should only need to read the code in cmdAdd.

Also I attached my project. If you see it you'll see a dollar sign but thats just a separate label with it in $, kinda cheap i know.

How I Can Include Indian Currency Format In Data Report
hi...
pls help me by providing information about how we can include indian currency format with data reports...thank u

TextBox Wanting To Make Input Text In Currency Format
Ok I am wanting to make the text typed into the textbox to be in currency format.

What I am wanting specifcally is when the user inputs text like; 30,000 or 30000 to automatically change it to $30,000.00

So if they were to type 1 it would be $1.00 or 100 $100.00 ect ect ect

Can this be done?

Convert Currency To Words (Indian Format) In Crystal Reports
Please can anyone help me how to convert number to words in Indian format in Crystal Reports.
eg. I want to convert Rs.25,12,000 as Rupees Twenty Five Lakhs Twelve thousand only.
The towords function converts into millions and billions and i want the result in Lakhs and crores.

Thanks in advance.

Insert Currency Data Type To MS Access Currency Field
Im want to insert a into a currency field in ms access using vb 6.0 but i keep gettin an error message. What should i place around the value to denote insert it.
here is my code:



VB Code:
Dim sqlstmt As String            sqlstmt = "INSERT INTO tbl_Products (ProductName,ProductDesc,SalesPrice,SpecialOffer,SpecialOfferPrice) VALUES (" & _              "'" & p_prodName & "', " & _              "'" & p_prodDesc & "', " & _              "'" & p_sPrice & "', " & _              "'" & p_specialOffer & "', " & _              "'" & p_soPrice & "' " & _              ")" MsgBox sqlstmt    db.Execute (sqlstmt)

Format (whatever,"Currency") Problem On Some Machines
Hi All,

I'm a little confused, I have a word document with vba code. part of the code uses the format(whatever,"Currency") command, and works fine on 97, 2000, 2002, 2003, But on some computers it is not working. I get an error, and it comes up in the references saying that the windows common controls are missing on these same computers when I check...???? Am I missing something? Have reinstalled word (complete install), but still no joy. It would appear to have something to do with the comctl32.ocx, but I'm not even sure that's right. We have even reinstalled the ocx, but that didn't help.

Any idea's?

It's past 1:30 in the morning here, so I won't be replying, but I would love to find suggestions or answers here tomorrow morning!!!

Thanx all in advance.

Format$(xoxo, "currency") Question
I am trying to get a running total of some items entered, and it works just fine when i am not using the Format$, but when I try to convert it to a running total the output is always zero.

Private Sub Command1_Click()

If Check1.Value = 1 Then discount = ((Val(Text1.Text) * (Val(Text2.Text) / 100 + 1)) * 0.1) 'calculating the discount with tax included.

If Check1.Value = 0 Then discount = 0
'stating no discount if box is unchecked

Label5.Caption = Format$(Val(Text1.Text) * (Val(Text2.Text) / 100 + 1) - discount, "currency")
'if i remove the format$ here, and in the next line I will get a running total in label7.caption. however with format$ involved it always returns $00.00

Label7.Caption = Format$(Val(Label7.Caption) + Val(Label5.Caption), "currency")

End Sub

Format Time In A Label
In a label I want to set a format time in the code so that the time is shown as hh:mm, but I can't seem to figure out where to place it. My code is:

res.MoveFirst
res.Find "ID=" & str(List1.ItemData(List1.ListIndex))
Label1.Caption = res!Kunstner
Label1.Caption = res!Kunstner & vbCrLf & "Title:" & res!title
Label1.Caption = res!Kunstner & vbCrLf & res!title & vbCrLf & res!genre
Label1.Caption = res!Kunstner & vbCrLf & res!title & vbCrLf & res!genre & vbCrLf & res!varighed & " sekunder"
Label1.Caption = res!Kunstner & vbCrLf & res!title & vbCrLf & res!genre & vbCrLf & res!varighed & " sekunder" & vbCrLf & res!prod_år

Please help me!!

How To Format The Label Field
Does anyone know how to format the label field output?
For example: the textbox is 1000000
then the label field will show up like this
10,000,000.00

thanks in advance

Format Label Failure In Module
Hi,

I just have a simple addition made in a module. After trying to change the format I get an error:
Module:

Code:
With frmBerekening
.lblTotaalOntvangen.Caption = CDbl(.lblOntvangenIncassade) + CDbl(.lblOntvangenCollega) + CDbl(.lblOntvangenCliente.Caption)
End With

My thought was after the calculation "give the caption the proper format"


Code:
With frmBerekening
.lblTotaalOntvangen.Caption = CDbl(.lblOntvangenIncassade) + CDbl(.lblOntvangenCollega) + CDbl(.lblOntvangenCliente.Caption)
.lblTotaalOntvangen.Caption = Format(lblTotaalOntvangen.Caption, "###,##0.00")
End With

Givers me Error: Complie Error : "Wrong number of arguments or invalid propertie assignment"

Someone that can help me out?
Thanks in advance

How To Format A Label To 2 Decimal Places...
I have a number of labels, displaying different prices -- how do I format them so the numbers are rounded to 2 d.p?

Under Properties, I tried Data Format... but this doesn't seem to work.

Your help will be much appreciated.

Thanks!

Label Control - Number Format
I display a number in label control. It has four digits after decimal point. I want to display two digits after the decimal point. How format the label control





Edited by - vagaisuresh on 11/13/2006 12:50:11 AM

Format(, "Currency") Does Not Work
i have this code in my program
lblAnswer.Caption = Format(sngAmount, "Currency")

when i run it i get this error:
can't find project or library

am i missing a reference or something? if so what?

please help

New To Using Format$(xxxxxxx."currency")
I have had no success using the format function as follows (the two
lines of code run one after the other):

'displays a running total of lblAmtdue.Caption
'contents in txtTotal.Text
txtTotal.Text = lblAmtdue.Caption + Val(txtTotal.Text)

'tries to format contents of txtTotal.Text as currency; doesn't work
txtTotal.Text = Format$(txtTotal.Text, "Currency")

Of what obvious formatting error am I guilty?

Bill

Form, Label Printing Alignment And Format
I've been trying to find out how to align and format data on forms and inside labels...not printing to paper, just displaying on my screen at runtime.

Here is my goal:

I printed several dozen numeric items out to various places on forms and inside labels on those forms. I want the data to align (right justify) so that all the dollar amounts align properly. I have two decimal places (cents) that I want to be aligned vertically in each column. I can get the data to print accurately, I just cannot get it to format or align properly.

Here is my problem:

On forms -- I can't get the information to right justify when I print the data directly to a form with the Print Tab(x) feature. I can get information to left justify but that is all.

On labels -- I can't get information inside labels to always print two decimal places for currency (etc.). twenty five dollars rounds off to 25 with no decimal places. But, I want it to appear as $25.00 or 25.00 without the dollar sign.

I'm printing out data and dollar amount information in columns and I want it to align it on the decimal place (always two decimal places).

I've done a number of searches now over the last few days and have looked in my manuals and have looked online and I've even played with the attributes of labels and forms but have not had any success. This HIT-MISS methodology is getting old and time consuming.

Anyone have any suggestions or would someone direct me to a site that can explain this in simple terms?

Thank you in advance for any assistance.

Need Help In Lauching Word And Add Address In Label Format
I have never done any vba programming.

I need to print preview labels.
Basically
Add a button "Print Preview " lauch word" and pass the parameters to print for each label.

The parameters to pass are "Name,Surname,Address,Town,Country Postcode"

I need to put on a word document with 10 labels for each word page.

Unfortunately i dont know where to start

Any code or suggestions?

Thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved