Discussion:
Telephone number partial query
(too old to reply)
t***@gmail.com
2018-08-09 19:31:49 UTC
Permalink
I am a relative beginner in access, but can usually find my way around pretty good. However, i have been having trouble with this one. I am trying to get a query to pull back all records that contain a partial telephone number. For example, if i know a number is 5551212, i want the query to pull back everything that shows 14045551212, 17065551212, etc... along with the additional info in the table for that number. The user has a table where they can put their number in, click a button to run the query and pull back the complete number. Right now, you have to know the 10 digit number to pull back the data in the other table. I am trying to allow them to just be able to put in a partial number. The enter a number table is joined to the data table. I am sure this is a simple solution i am just missing, so any help would be great.
Ron Weiner
2018-08-09 21:08:18 UTC
Permalink
Post by t***@gmail.com
I am a relative beginner in access, but can usually find my way around pretty
good. However, i have been having trouble with this one. I am trying to get a
query to pull back all records that contain a partial telephone number. For
example, if i know a number is 5551212, i want the query to pull back
everything that shows 14045551212, 17065551212, etc... along with the
additional info in the table for that number. The user has a table where they
can put their number in, click a button to run the query and pull back the
complete number. Right now, you have to know the 10 digit number to pull back
the data in the other table. I am trying to allow them to just be able to put
in a partial number. The enter a number table is joined to the data table. I
am sure this is a simple solution i am just missing, so any help would be
great.
---
This email has been checked for viruses by AVG.
https://www.avg.com
Use the WildCard Character * for many and ? for One character.

SELECT This, That, TheOther FROM YourTable WHERE Phone Like '*5551212'
ORDER BY whatever

That will return all if the Phone Numbers that end in 5551212

Rdub
Ulrich Möller
2018-08-09 21:13:23 UTC
Permalink
Hi,
Post by t***@gmail.com
I am a relative beginner in access, but can usually find my way around pretty good. However, i have been having trouble with this one. I am trying to get a query to pull back all records that contain a partial telephone number. For example, if i know a number is 5551212, i want the query to pull back everything that shows 14045551212, 17065551212, etc... along with the additional info in the table for that number. The user has a table where they can put their number in, click a button to run the query and pull back the complete number. Right now, you have to know the 10 digit number to pull back the data in the other table. I am trying to allow them to just be able to put in a partial number. The enter a number table is joined to the data table. I am sure this is a simple solution i am just missing, so any help would be great.
There is a like operator for searching with wildcards in a query.
See
https://www.w3schools.com/sql/sql_like.asp
https://msdn.microsoft.com/en-us/library/bb208897(v=office.12).aspx

Ulrich

Loading...