I'm working with several phone numbers, and five area codes. I'd like to exclude one of these area codes and only show the other four.
I'm trying to exclude "614" and I've tried a couple different things but can't seem to get it.
Thanks!
I'm working with several phone numbers, and five area codes. I'd like to exclude one of these area codes and only show the other four.
I'm trying to exclude "614" and I've tried a couple different things but can't seem to get it.
Thanks!
Are area code and phone in the same field? Is there parens around the area code? You want to exclude all records with area code 614?
Try:
SELECT * FROM Table WHERE Not PhNum Like "614*";
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.
The phone numbers are like this: (###) ###-####
Table is Membership , Title is "HomePhone"
Would something like this work?
Not Like "(614#)" ?
No.
SELECT * FROM Table WHERE Not Like "(614)*";
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.
Syntax is incorrect?
Sorry, I forgot the field.
SELECT * FROM Table WHERE Not PhNum Like "(614)*";
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.
I ran : SELECT * FROM [Membership] WHERE Not HomePhone Like "(614)*"; and still got invalid syntax. Am I doing some stupid mistake or something?
Okay, I had to go build query to refresh memory. If you used the Access query builder it would get the syntax correct for you.
SELECT * FROM Membership WHERE HomePhone Not Like "(614)*";
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.
I think I found the problem, in my builder there is no "Select". I'm running the same version as you though so I don't know what's going on. I can just run it normally and go back and delete the 614s. Thanks for the help though, I appreciate it
Open query builder and select tables from the list, drag fields to the grid, type parameters on Criteria row. Switch to SQL View to see the code.
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.
I only see an Elements and Categories list and tables isn't in either of them
Edit- Found it, I put in:
Membership]![HomePhone] Not Like "(614)"
But it still came up with 614
Is this the code you meant?
SELECT Membership.FName, Membership.LName, Membership.City, Membership.State, Membership.HomePhone
FROM Membership
WHERE (((Membership.HomePhone)=[Membership]![HomePhone])) OR (((Membership.HomePhone)=[parameters]));
Where are you seeing Elements and Categories?
Where are you trying to construct this?
Yes, that is SQL statement.
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.