Solved

Restricting Input on An Unbound Field

Posted on 2014-01-28
1
395 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

679 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