Solved

Change appearance of entered numbers

Posted on 2014-11-22
5
107 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
[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
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 58
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 50

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

690 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