Solved

Restricting Input on An Unbound Field

Posted on 2014-01-28
1
390 Views
Last Modified: 2014-01-31
I have an unbound field on my form.  A valid entry in this box could be any long integer number up to nine positions.


I have the format defined as 000000000.  I got a cancellation today when I tried to treat the entered field as numeric.

The field has been on the form several weeks without incident.

Today I was notified of a cancellation and the error displayed was "13 Type Mismatch".  Apparently I need to do more to restrict the input to numeric only and limit the length to no more than 9 digits.


I can't figure out how they got something in there that led to a type mismatch.  In my testing I can't get anything in there other than a number.

I was able to get an overflow error by entering 1 followed by 11 0's.

How can I tighten up the entry so only digits with a max length of 9 can be entered?
0
Comment
Question by:mlcktmguy
1 Comment
 
LVL 22

Accepted Solution

by:
rspahitz earned 250 total points
ID: 39816928
A great way for that is to define some Code Event Procedure code in the On Exit "field", something like this:

Private Sub MyText_Exit(Cancel As Integer)
    If Not IsNumeric(MyText.Value) Then
        Cancel = True
    ElseIf Len(MyText.Value) > 9 Then
        Cancel = True
    End If

End Sub
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

912 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now