Solved

Change appearance of entered numbers

Posted on 2014-11-22
5
105 Views
Last Modified: 2014-11-28
On a form I have two fields.  The first field is named txtSIZE_CURRENT.

If the user enters, for example, 0.109 in that field I want the 2nd field named txtPartNsize to read 1090

(always 4 numbers)

The following is close but I can't get rid of the period.  It is currently reading .1090

Me.txtPartNsize = Format([txtSIZE_CURRENT], Left(".", [txtDecimals]) & String([txtDecimals], "0"))
0
Comment
Question by:SteveL13
5 Comments
 

Author Comment

by:SteveL13
ID: 40459512
Oh, and there is a 3rd field... txtDecimals that will always have a default value of 4
0
 
LVL 18

Expert Comment

by:Simon
ID: 40459528
Is there any restriction on what the user may enter in the first text box. Is it bound to a numeric field or is it unbound with an input mask?

e.g. User entry could be
0.1
14012
99
one
twenty three

From your original example, the input number could simply be multiplied by 10,000 to produce the desired result. I think we need a more extensive set of example inputs and corresponding desired results to advise properly on this.
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 250 total points
ID: 40459530
try

Me.txtPartNsize =[txtSIZE_CURRENT] * 10000
0
 
LVL 57
ID: 40459546
I think it might be better to step back and spell out what your trying to do (i.e. significant rounding) rather than focusing on this smaller part of the problem.

Jim.
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 250 total points
ID: 40460116
You are close.
Perhaps this, as the default 4 may change:

Me.txtPartNsize = Left(Format([txtSIZE_CURRENT] * 10 ^ [txtDecimals], String([txtDecimals], "0")), [txtDecimals])

/gustav
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

830 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