Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-16-2010, 01:43 PM
slenish slenish is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Mar 2010
Posts: 2
slenish is on a distinguished road
Default Check for numbers in a combo box

Hello,

Ok I have a combo box that I set up so that you can only enter in letters in to it. At the moment it works great! If you enter numbers in you get an error message but I just did another test where if I enter a combination of numbers and letters it will save. How do i get the box to check for if numbers are mixed in with letters to error out?

Here is the code I have so far,

Code:
If IsNumeric(Me![Combo57].Text) Then
  MsgBox "You must enter letters in this field", vbYes, "Invalid Entry"
   Response = acDataErrContinue
    Me![Combo57].Undo
     Exit Sub
End If
Not sure If I can add to this one, or do i need to make another if statement.

Apperciate the help
Reply With Quote
  #2  
Old 03-17-2010, 04:14 AM
Stressed Stressed is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Mar 2010
Posts: 19
Stressed is on a distinguished road
Default

Quote:
Originally Posted by slenish View Post
Hello,

Ok I have a combo box that I set up so that you can only enter in letters in to it. At the moment it works great! If you enter numbers in you get an error message but I just did another test where if I enter a combination of numbers and letters it will save. How do i get the box to check for if numbers are mixed in with letters to error out?

Here is the code I have so far,

Code:
If IsNumeric(Me![Combo57].Text) Then
  MsgBox "You must enter letters in this field", vbYes, "Invalid Entry"
   Response = acDataErrContinue
    Me![Combo57].Undo
     Exit Sub
End If
Not sure If I can add to this one, or do i need to make another if statement.

Apperciate the help
I posted some code that will prevent numbers from being entered. No need for IsNumeric...

http://www.accessforums.net/database-design/setting-field-only-accept-text-characters-not-numbers-4763.html#post16706
Reply With Quote
  #3  
Old 03-17-2010, 05:03 PM
c_smithwick c_smithwick is offline Windows 7 Access 2003 (version 11.0)
Underpaid Programmer
 
Join Date: Jan 2010
Location: Lakeside, CA
Posts: 49
c_smithwick is on a distinguished road
Default

set your combo box input mask property to "???????????" (number of question marks equal to the maximum length of your possible entries. This will restrict entry to letters only, with each position optional so you can enter from 0 to the maximum number of letters permitted.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
check box criteria? kzoll@mindspring.com Queries 3 11-24-2009 06:43 AM
Check Box Value mulefeathers Programming 4 10-09-2009 06:31 PM
Limit combo box 2 values based off of combo box 1 selection jmartin Forms 1 08-26-2009 08:45 AM
Filtering subform combo from main form combo MUKUDU99 Forms 0 08-17-2008 10:19 AM
check boxes chiefmsb Forms 1 11-14-2006 11:22 AM


All times are GMT -8. The time now is 08:31 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.