Results 1 to 3 of 3
  1. #1
    slenish is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    2

    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

  2. #2
    Stressed is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    19
    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...

    https://www.accessforums.net/database-design/setting-field-only-accept-text-characters-not-numbers-4763.html#post16706

  3. #3
    c_smithwick is offline Underpaid Programmer
    Windows 7 Access 2003
    Join Date
    Jan 2010
    Location
    Lakeside, CA
    Posts
    49
    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.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. check box criteria?
    By kzoll@mindspring.com in forum Queries
    Replies: 3
    Last Post: 11-24-2009, 09:43 AM
  2. Check Box Value
    By mulefeathers in forum Programming
    Replies: 4
    Last Post: 10-09-2009, 08:31 PM
  3. Replies: 1
    Last Post: 08-26-2009, 10:45 AM
  4. Replies: 0
    Last Post: 08-17-2008, 12:19 PM
  5. check boxes
    By chiefmsb in forum Forms
    Replies: 1
    Last Post: 11-14-2006, 02:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums