Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post Code Query

Status
Not open for further replies.

mrjolly23

Technical User
Oct 16, 2001
1
GB
Hi

I have an address database which i want my sales people to use. Each sales person has their own group of postcodes.

For example Harry looks after AB, DD, DG, G. and this is where the problem comes in........i have been writing the query as:

Like "ab*" Or Like "DD*" Or Like "DG*" Or Like "EH*" Or Like "FK*" Or Like "G*"

and when the query is run, it lists all the G prefixed postcodes, including GU and GL which are other sales persons postcodes. I would like the query not to have exclusions and it defeats the object of the query.

Please can someone help?

Thanks

Mark
 
Since you say that you don't want to have exclusions (I gather you mean Like 'G*' AND <> 'GU'), the only way I can think of is to remove the LIKE and make it specific:

Like &quot;ab*&quot; Or Like &quot;DD*&quot; Or Like &quot;DG*&quot; Or Like &quot;EH*&quot; Or Like &quot;FK*&quot; Or = &quot;G&quot;

Hope that helps... Terry M. Hoey
 
Create a subtable for AssignedPostCodes. In this table add a foreign key link to the sales people table and a foreign key link to the zip code table. Make these two fields a compound primary key. This will prevent you from add the same zip code to the same sales person more than once. Add this table as a subform to your sales people information table. Select all of the zipcodes each person is responsible for as individual records in this subform. You'll only need to set this up once and should only need to modify it infrequently. Use this table in your queries to limit the postcodes to each individual sales person. In this way you can use one query for everyone.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top