Identify string or number

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I have a table which has an ID field with the text data
type. I would like to query that field and figure out
which records contain strings that can convert to a
number, and which cannot; the ones that can convert to a
number will be used as the row source for a combo box). I
tried using CLng([ID]), and receive an error for the ones
that cannot convert, but that doesn't do me any good,
because the combo box still lists the record in its row
source.

What can I do to make sure only IDs that can convert to a
number are included in the resulting recordset of the
query?

Any help is greatly appreciated.
 
You could add a calculated field to your query, as follows:

IncludeRec: Iif(IsNumeric([ID]), True, False)

Then, in the Criteria row, set the criteria to True


hth,
 
Cheryl

The simple Calculated Field:

IncludeRec: IsNumeric([ID])

should work equally well (I think).

Cheers
Van T. Dinh
MVP (Access)
 
You're so right!!

--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Van T. Dinh said:
Cheryl

The simple Calculated Field:

IncludeRec: IsNumeric([ID])

should work equally well (I think).

Cheers
Van T. Dinh
MVP (Access)



-----Original Message-----
You could add a calculated field to your query, as follows:

IncludeRec: Iif(IsNumeric([ID]), True, False)

Then, in the Criteria row, set the criteria to True


hth,
 
Back
Top