Solved

Restricting Input on An Unbound Field

Posted on 2014-01-28
1
388 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
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 retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

763 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

6 Experts available now in Live!

Get 1:1 Help Now