Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / December 2007

Tip: Looking for answers? Try searching our database.

AfterUpdate Event for TextBox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Curtis Stevens - 03 Dec 2007 16:24 GMT
I have this code for the afterupdate event on a text box that has data in it.

Me.Text732 = Replace(Abs(Val([Text732])), ".", "")

When I past this data 0000272400123456 into the text box, it gets rid of the
0000, becomes 272400123456

But if I past this kind of number 4223697600059898, it turns it into this
42236976000599E+15

If I take the coding away and past the 4223697600059898 number, it stays the
same and doesn't get changed to the +15.

Any suggestions or changes to code to fix this?

Thanks!

Curtis
Rhys Davies - 03 Dec 2007 17:01 GMT
if its a text field then it shouldnt be modifying any values that you enter
into it - check the field to make sure that its set up as a text field in the
table and on the form itself

> I have this code for the afterupdate event on a text box that has data in it.
>
[quoted text clipped - 14 lines]
>
> Curtis
Klatuu - 03 Dec 2007 17:08 GMT
Using the Val function turns the string into a number.  Numbers do not have
leading zeros.  You will need to treat the value in the text box as a string.
Signature

Dave Hargis, Microsoft Access MVP

> I have this code for the afterupdate event on a text box that has data in it.
>
[quoted text clipped - 14 lines]
>
> Curtis
Dirk Goldgar - 03 Dec 2007 17:11 GMT
>I have this code for the afterupdate event on a text box that has data in
>it.
[quoted text clipped - 13 lines]
>
> Any suggestions or changes to code to fix this?

It's weird to be doing string operations on a number.  What are you actually
trying to accomplish?  Also, is this text box bound or unbound, if bound
what is it bound to, and should it always contain a number?

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Marshall Barton - 03 Dec 2007 18:05 GMT
>I have this code for the afterupdate event on a text box that has data in it.
>
[quoted text clipped - 8 lines]
>If I take the coding away and past the 4223697600059898 number, it stays the
>same and doesn't get changed to the +15.

That string of digits is too long for the Val function to
convert to a number.  Instead of trying to manipulate the
digits with numeric functions, you should think of it as a
text string.

It looks like all your line of code is doing is deleteing
any dots in the string of digits.  In that case, there is no
reason to use Abs(Val(

OTOH, your code does nothing to prevent a user from entering
non numeric digits, which will also mess up the result of
using Val.

Maybe you have some other unexplained things going on, but I
am having trouble guessing at what objective that code is
attempting to achieve.

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.