Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Restricting Input on An Unbound Field

Posted on 2014-01-28
1
Medium Priority
?
409 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 22

Accepted Solution

by:
rspahitz earned 1000 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

Industry Leaders: 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!

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

609 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