?
Solved

Automatic comma separator per thousand while entering numbers

Posted on 2003-04-01
8
Medium Priority
?
1,017 Views
Last Modified: 2008-02-26
hello guys,

a system user of mine asked if i could insert automatically a comma per thousand in her entry. i've done it automatically using the chage event and the format function. my problem is the decimal point and the numbers after it, since she is entering an amount.

could anyone help me with this please.....

 
0
Comment
Question by:MIGS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 8244393
Try use the Replace function.

like:

text = Replace(text,vbcrlf, ";" & vbcrlf)
0
 
LVL 3

Expert Comment

by:DocM
ID: 8244441
Hi,

You could use the MaskedEditBox.
MaskEdBox1.Mask = "###,###.##"
0
 
LVL 3

Expert Comment

by:happel
ID: 8244678
For inputformatting use MaskedEditBox (like DocM said) or
on LostFocus event : Text1.Text=Format(Text1.Text, "Currency")

VB-Help:
 
Currency
   Display number with thousand separator, if appropriate;  
   display two digits to the right of the decimal separator.
  Output is based on system locale settings.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:cmgarnett
ID: 8244687
If the user is entering a number into a text field can you use this in your Change event?

'Remove any commas in the number
Text1.Text = Replace(Text1.Text,",","")

wrkNumber = Val(Text1.Text)

Text1.Text = Trim(Format(wrkNumber, "###,###,###,###,###.###########"))
0
 
LVL 5

Accepted Solution

by:
jayeshshah earned 200 total points
ID: 8245372
in the lostfocus or validate event of your textbox write the below code

Text1.Text = Format(Text1.Text, "###,##0.00")


The reason why i am not advising you to write it in the change event or other events is that Change and keypress events are fired while the user is doing some entry in the textbox. and the Validate and lost focus events are fired after the user has finished the data entry.

K'Regards

Jayesh
0
 
LVL 3

Expert Comment

by:cmgarnett
ID: 8245389
Its all a case of whether you want to see the number being formatted as its typed in.
0
 

Expert Comment

by:CleanupPing
ID: 8531210
Hi MIGS,
This old question (QID 20569849) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9017900
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept jayeshshah's comment as answer
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GrahamSkan
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

765 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