Allow values as per the precision

Hi,

i want to allow the user to enter the value in a field in the format
66666.45 because the corresponding column in the Oracle database can allow
number in format 5,2.
If i take the max length of the field as 7 and the user
enters the number say 6666666, the max length will pass (because the length is still 7) but while saving i get "Multiple Step Generated Errors" because the entered number does not correspond to that of the allowed max length (5,2) of the database column.
How can i validate this  and allow the user to enter the number in the
allowed format ??

Regards,
acptAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bruintjeCommented:
Hello acpt,

you could look at the function posted here by Rick Rothstein
source: http://groups.google.com/group/microsoft.public.vb.enterprise/msg/32e1a11fc13b42f2

hope this helps a bit
bruintje
0
WimCommented:
add a test for the length of the number before the decimal point:

    Dim lngNumber As Long
    If IsNumeric(Text2.Text) Then
        lngNumber = Fix(Text2.Text)
        If Len(CStr(lngNumber)) <= 5 Then
            MsgBox "len =< 5"
        Else
            MsgBox "len > 5"
        End If
    End If
0
EDDYKTCommented:
can you just check between

99999.99 and -99999.99
0
Leo EikelmanDirector, IT and Business DevelopmentCommented:
Why don't you create a mask edit box?

with properties

Mask = 99999.99
Fromat = #####.##


Leo
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Leo EikelmanDirector, IT and Business DevelopmentCommented:
You should be able to find the Masked Edit Control by selecting Project/Components from the IDE menu, scrolling down until you find Microsoft Masked Edit Control 6.0. If it's not there on the list, you may need to search your hard drive or installation CD for the file MSMASK32.OCX and register it with Regsvr32.


Leo
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.