Remove multiple numbers from field with code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I would like to create a query that will allow me to remove particular
group of phone numbers from a field.

ex. (IIf([table1].[field1]="1234567890", null, [table1])) works, but, only
for one number. How would I add more numbers to make null? I've tried various
other soultions with varying levels of success, but, nothing yet that works.

Thanks in advance
-hysonmb
 
Hysonmb,

A variation on your method would be...
IIf([field1] In("123456","234567","345678"),Null,[field1])

Another approach would be to make another table with a field in which
you list the exception phone numbers, and then make a query using this
table and your table1, something like this...
SELECT table1.field1
FROM table1 LEFT JOIN Exceptions ON table1.field1 = Exceptions.NoPhone
WHERE Exceptions.NoPhone Is Null
 
Steve,
Thanks for the solution.

Steve Schapel said:
Hysonmb,

A variation on your method would be...
IIf([field1] In("123456","234567","345678"),Null,[field1])

Another approach would be to make another table with a field in which
you list the exception phone numbers, and then make a query using this
table and your table1, something like this...
SELECT table1.field1
FROM table1 LEFT JOIN Exceptions ON table1.field1 = Exceptions.NoPhone
WHERE Exceptions.NoPhone Is Null

--
Steve Schapel, Microsoft Access MVP

Hello,
I would like to create a query that will allow me to remove particular
group of phone numbers from a field.

ex. (IIf([table1].[field1]="1234567890", null, [table1])) works, but, only
for one number. How would I add more numbers to make null? I've tried various
other soultions with varying levels of success, but, nothing yet that works.

Thanks in advance
-hysonmb
 
Back
Top