Format results of query as Text

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

I have a form with a dropdown combo box that has a record source from a
query with a field that is all integers.

I want to use this combo box on a search form and allow the user to either
select from the list of numbers or optionally type in in special characters
like "!", "<", ">" before the number

i.e. "!6" Meaning select all records that are not in group 6.

However because the field consists of all integers, typing any text
characters causes an error. Something like "The value you entered isn't
valid for this field"

Can anyone please suggest if I can force the query to format the field as
"Text" so that even though a number is selected it will also allow text to
be entered in the combo box.

The only options I get for formatting within the query is for various
numeric formats?

Hope that made some sense
Thanks in Advance
Andrew.
 
Change the field to a calculated field.

Example:
In the Field row of the design grid
NumberAsString: CStr(Nz(
.[Field],""))

If you are sorting on this field, it will change your sort from numeric to string as well.
This means 2 will follow 19. To get around this, remove the sort from this field and add
the field to the query again without making it a calculated field. Set the sort on this
instance and remove the check from the Show checkbox.
 
Back
Top