Jump to content

how to check if a field is numeric?


kewlsammie

Recommended Posts

guys.. i have a problem.. i am working on a important/urgent project tat.. requires MI to check if a field in MS access is Numeric... i tried isNumeric() but it didn't work.. any ideas????
It really helps to see sourcecode, that makes diagnosing the problem much easier. Its not exactly clear if you want to use Access to check for numeric, or if you want to use an SQL statement to check for numeric, or if you want to use ASP to check, so here are all three ways:Using Access: generally, you should stay away from Access database, they can't serve two users simultaneously, and they give a "too many users connected" error when you have more than 10 users on your site at the same time. However, if you really want to use Access, then when setting up a table in design mode, you can tell Access what kind of datatype a field is going to be used for (i.e. whether its going to be a text field, a date/time field, a number field). If you try to insert the wrong data into the field, you'll get an error.Using SQL: I think you can write a statement like "SELECT * FROM some_table WHERE IsNumeric(some_field) = True;", and Access will execute it properly.Using ASP: there a few ways to check whether data is numeric, the easiest way is using IsNumeric(someString), which will return true or false if the string contains any non-numeric characters.You can also use regular expressions, but I wouldn't see why you'd have to if you're not doing anything more complicated than checking for numeric values.
BTW is this SQL called MySQL?? Thankz~
MySQL is the name of a type of database, just like MS Access is the name of a database.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...