Best way to test text data for alphanumeric characters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ncsthbell
    New Member
    • May 2007
    • 167

    Best way to test text data for alphanumeric characters

    I am hoping for suggestions on the best way to handle this. I am importing data from an excel spreadsheet into an access .mdb. One column on the spreadsheet ('colA') is in text format and is imported into a table in text format. I have to read the imported data and insert into production tables. The problem is 'colA' is being inserted into a column on the prod table this has a datatype of double. If the imported data in this column has an alpha charater, it is a bad value. These should only be numeric values... however, I have to handle the bad data coming in on the import. If I have the data in a column defined as text, how can I test to see if it contains a 'non numeric' character so my insert doesn't blow!!
    THanks
  • Mariostg
    Contributor
    • Sep 2010
    • 332

    #2
    IsNumeric() function will return -1 for 123, 0 for ABC, 0for abc3. You could test with that.

    Comment

    • Oralloy
      Recognized Expert Contributor
      • Jun 2010
      • 988

      #3
      Use an error trap ON ERROR and numeric conversion cnum

      Comment

      Working...