Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 150
  • Last Modified:

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,
0
acpt
Asked:
acpt
1 Solution
 
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
 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now