• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 111
  • Last Modified:

Change appearance of entered numbers

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
SteveL13
Asked:
SteveL13
2 Solutions
 
SteveL13Author Commented:
Oh, and there is a 3rd field... txtDecimals that will always have a default value of 4
0
 
SimonCommented:
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
 
Rey Obrero (Capricorn1)Commented:
try

Me.txtPartNsize =[txtSIZE_CURRENT] * 10000
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
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
 
Gustav BrockCIOCommented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now