UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Changing Last 2 Digits To A Decimal, Office 2003    
 
   
johan
post May 22 2012, 04:25 AM
Post #1

UtterAccess Guru
Posts: 640
From: Riebeek Kasteel, Western Cape, South Africa



How can change last to digits in a currency field to a decimal. In other words if I enter 12345 in should display as 123.45
Go to the top of the page
 
+
Peter46
post May 22 2012, 04:27 AM
Post #2

UtterAccess VIP
Posts: 7,440
From: Oadby Leics, UK



This sounds like quite a dangersous thing to do.
But you can use the afterupdate event procedure and do..


Me.textboxname = nz(me.textboxname)/100

Go to the top of the page
 
+
johan
post May 22 2012, 04:56 AM
Post #3

UtterAccess Guru
Posts: 640
From: Riebeek Kasteel, Western Cape, South Africa



Thanx Peter46. I know it's a bit dangerous but it makes value inputs eazier and quicker
Go to the top of the page
 
+
BruceM
post May 22 2012, 06:12 AM
Post #4

UtterAccess VIP
Posts: 2,479
From: Downeast Maine



QUOTE
it makes value inputs eazier and quicker

As long as everybody knows to enter the decimal part of the value even if it is 0.
Go to the top of the page
 
+
johan
post May 22 2012, 06:26 AM
Post #5

UtterAccess Guru
Posts: 640
From: Riebeek Kasteel, Western Cape, South Africa



Bruce I'm aware of that. I will send communique in this regard to the users. Thanx for the info
Go to the top of the page
 
+
Bob G
post May 22 2012, 07:15 AM
Post #6

UtterAccess VIP
Posts: 8,193
From: CT



I know that the below code is syntaxtually incorrect but I am in a hurry and wanted to at least get it posted.
wouldnt you need to consider if the user entered it with a decimal in the first place?

Me.textboxname = iif(instt(1,me.textboxname,"."),,nz(me.textboxname)/100)
Go to the top of the page
 
+
BruceM
post May 22 2012, 07:40 AM
Post #7

UtterAccess VIP
Posts: 2,479
From: Downeast Maine



QUOTE
I will send communique in this regard to the users

If that reminder is enough, where can I get some of your users? (IMG:style_emoticons/default/laugh.gif)

To fill out Bob's suggestion a little, maybe something like:

Me.Textboxname = IIf(InStr(Me.Textboxname,".") > 0, Me.TextBoxName, Nz(Me.Textboxname,0)/100)

This post has been edited by BruceM: May 22 2012, 07:50 AM
Go to the top of the page
 
+
fkegley
post May 22 2012, 12:57 PM
Post #8

UtterAccess VIP
Posts: 23,583
From: Mississippi



You could also use the KeyPress event to do this couldn't you? You could test each ASCII code for digit or decimal point. If digit, join to previous entry, if decimal point, then if no decimal point already, join to previous entry. Once decimal point entered only allow at most two more digits. Then use Format function in AfterUpdate event of text box to present the entry as desired.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 11:27 PM