Solved

Change appearance of entered numbers

Posted on 2014-11-22
5
104 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

770 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