I have an access query with a list of customer phone numbers. I only want to show the ones from a certain area code. How do I go about doing this?
I have an access query with a list of customer phone numbers. I only want to show the ones from a certain area code. How do I go about doing this?
Depends what the format of the phone number is. If it is a text field with numbers only (for instance), have a field in the query with xxx:Left(PhoneNumber,3) - and then in the criteria line put your area code.
(###) ###-####
So a field that is defined as: Left(PhoneNumber,5) has in the criteria line : ="(123)"
So are the () and - and space actually saved in the data? Are you using Mask property for data entry? Is the mask set to save the () and - and space characters?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
That is correct. I was trying "Like 212" because that's how I did it with zip codes, but that must not be right.
LIKE is meaningless without wildcard, might as well use =.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Well it was put in as *212, and it turned into "like 212" and nothing was visible in the data sheet view
Query syntax would be like:
SELECT * FROM table WHERE PhoneNumber LIKE "(212)*";
That assumes the () are actually in the data and not just display format.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.