Query Using Mid$

  • Thread starter Thread starter GBL
  • Start date Start date
G

GBL

Hi:
I'm tearing my hair out!!
I'm trying to "filter" out records that I do not wish to view from a
database (Radio) of 63 records of radio stations data. The field, "Car" (5
character Text Type) has about ten records listed as AM1-1, AM1-2, AM2-3,
FM1-1, FM2-3...etc. The rest of the records of this field are blank.
My attempt to build a query using Mid$([Car],1,2) OR Left$([Car],2) in
the query field slot with an "AM" in the criteria slot always produces a "
Data type mismatch in the criteria expression" error.
Help please!! and Thanks in Advance!!
 
The field, "Car" (5
character Text Type) has about ten records listed as AM1-1, AM1-2, AM2-3,
FM1-1, FM2-3...etc. The rest of the records of this field are blank.
My attempt to build a query using Mid$([Car],1,2) OR Left$([Car],2) in
the query field slot with an "AM" in the criteria slot always produces a "
Data type mismatch in the criteria expression" error.

The problem is that the Left() and Mid() functions require a string
argument - and a NULL value is not a string!

Try

Left(NZ([Car], " "), 2)
 
Hi John:
Thank you for your response. I will give it a try!!

Pray tell; what is the designation NZ ??

John Vinson said:
The field, "Car" (5
character Text Type) has about ten records listed as AM1-1, AM1-2, AM2-3,
FM1-1, FM2-3...etc. The rest of the records of this field are blank.
My attempt to build a query using Mid$([Car],1,2) OR Left$([Car],2) in
the query field slot with an "AM" in the criteria slot always produces a "
Data type mismatch in the criteria expression" error.

The problem is that the Left() and Mid() functions require a string
argument - and a NULL value is not a string!

Try

Left(NZ([Car], " "), 2)
 
Hi John:
Thank you for your response. I will give it a try!!

Pray tell; what is the designation NZ ??
NZ() is an Access defined function, Null To Zero; it take two
arguments. If the first argument is NULL it returns the value of the
second argument. If you omit the second argument it returns zero.
 
Back
Top