![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a table with around 18,000 records in it. One of the fields is a Text field, but 85% of the things in that field is a number (The other 15% is a number with a text suffix). I was wondering if there was an easy way to Sort this field as if it were a number (because, when it sorts as text it looks like this... 1 11 12 14 2 21 24 3 35 So far, the only thing I came up with was to make a query with this expression... TempSection: CDbl([Section]) But that either produces a #Error for those rows where the Section has a text character in there or it won't even open the query in datasheet view because of Data type mismatch in criteria expression. What can I do? Can I create an iif statement to catch that error? or Something? Thanks! |
#3
| |||
| |||
|
|
I have a table with around 18,000 records in it. One of the fields is a Text field, but 85% of the things in that field is a number (The other 15% is a number with a text suffix). I was wondering if there was an easy way to Sort this field as if it were a number (because, when it sorts as text it looks like this... 1 11 12 14 2 21 24 3 35 So far, the only thing I came up with was to make a query with this expression... TempSection: CDbl([Section]) But that either produces a #Error for those rows where the Section has a text character in there or it won't even open the query in datasheet view because of Data type mismatch in criteria expression. What can I do? Can I create an iif statement to catch that error? or Something? Thanks! |
#4
| |||
| |||
|
|
I have a table with around 18,000 records in it. One of the fields is a Text field, but 85% of the things in that field is a number (The other 15% is a number with a text suffix). I was wondering if there was an easy way to Sort this field as if it were a number (because, when it sorts as text it looks like this... 1 11 12 14 2 21 24 3 35 So far, the only thing I came up with was to make a query with this expression... TempSection: CDbl([Section]) But that either produces a #Error for those rows where the Section has a text character in there or it won't even open the query in datasheet view because of Data type mismatch in criteria expression. What can I do? Can I create an iif statement to catch that error? or Something? Thanks! |
#5
| |||
| |||
|
|
Should be a simple matter of ORDER BY val(strField) if I'm understanding your problem correctly... but it's late. to test this create a table (tblStrNum) with 2 fields (str:text,num:number) open the table and enter 1,22text,100 into str. now enter 1,22,100 into num. create a query (qrySortStrNum): Select str,num FROM tblStrNum ORDER BY str; str num 1 1 100 100 22text 22 this represents your current situation. now modify the sql to read: Select str,num FROM tblStrNum ORDER BY val(str); result: str num 1 1 22text 22 100 100 and thereyago :-) -John ngiven (AT) hotmail (DOT) com (Nathan Given) wrote in message news:<f749d926.0310051531.a1f1a3d (AT) posting (DOT) google.com>... I have a table with around 18,000 records in it. One of the fields is a Text field, but 85% of the things in that field is a number (The other 15% is a number with a text suffix). I was wondering if there was an easy way to Sort this field as if it were a number (because, when it sorts as text it looks like this... 1 11 12 14 2 21 24 3 35 So far, the only thing I came up with was to make a query with this expression... TempSection: CDbl([Section]) But that either produces a #Error for those rows where the Section has a text character in there or it won't even open the query in datasheet view because of Data type mismatch in criteria expression. What can I do? Can I create an iif statement to catch that error? or Something? Thanks! |
![]() |
| Thread Tools | |
| Display Modes | |
| |