Results 1 to 12 of 12
  1. #1
    Join Date
    Jan 2015
    Posts
    5

    Lightbulb query to find postcodes

    Hi there,



    i was just wondering if there was something i would be able to do to speed the process that im doing at the minute up. iv been give millions of records that oi now need to split into postcode areas,how would i do this ? at the minute iv got one query that im changing every time to search for a different postcode but i have to search for 33 postcodes in 12 different tables. i didn't know if there was any way for access to use one query to search through all 12 tables and 33 different postcodes and give a result page of how many people are in each postcode that i have got on my database.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I added a modified universal search to the code repository here. It will work for field values in multiple tables, but I wouldn't suggest if for millions of records.
    You could copy the database, and put a limit of say 5000 records or some number to see what the performance is like. I'd like to know how it works with real volume.

    You can use a user defined function to do repeated things.

    It would be helpful if you could post a copy of your database -- remove confidential/private info first. We don't need a million records for testing.

  3. #3
    Join Date
    Jan 2015
    Posts
    5

    Smile

    Quote Originally Posted by orange View Post
    I added a modified universal search to the code repository here. It will work for field values in multiple tables, but I wouldn't suggest if for millions of records.
    You could copy the database, and put a limit of say 5000 records or some number to see what the performance is like. I'd like to know how it works with real volume.

    You can use a user defined function to do repeated things.

    It would be helpful if you could post a copy of your database -- remove confidential/private info first. We don't need a million records for testing.
    thanks for the quick reply but id don't really understand what you mean here. i may not have explained my self fully. i cant upload any of the data as it is all confidential so i will try to explain some more. i have a 12 tables in each they have people contact information including postcodes. i need to separate the postcodes to then find out how many people are in each postcode. so when i do what ever i need to do make this it would show me how many records of data i have within each postcode area like postcodes starting with E. at the minute im doing it manually by creating a query importing one table selecting postcode and in the criteria field writing - like "E*****". and then seeing how much pieces of data that match the searchand then importing the amount of people into an excel sheet for example when i ran that it gave me 3822 records which i then just made an excel sheet so i could keep a note of how many people are in each set of postcodes. hopefully this makes sense and you can help me out

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Show me the design of one table (take a screen capture of the table design view).
    Where you located? What postal code system are you using.
    It would be helpful if you could export some fields in the table including the postal code as a csv file that I could load.
    Just enough fields to simulate your problem data -- no need for names.

  5. #5
    Join Date
    Jan 2015
    Posts
    5
    Quote Originally Posted by marc aalders-dunthorne View Post
    thanks for the quick reply but id don't really understand what you mean here. i may not have explained my self fully. i cant upload any of the data as it is all confidential so i will try to explain some more. i have a 12 tables in each they have people contact information including postcodes. i need to separate the postcodes to then find out how many people are in each postcode. so when i do what ever i need to do make this it would show me how many records of data i have within each postcode area like postcodes starting with E. at the minute im doing it manually by creating a query importing one table selecting postcode and in the criteria field writing - like "E*****". and then seeing how much pieces of data that match the searchand then importing the amount of people into an excel sheet for example when i ran that it gave me 3822 records which i then just made an excel sheet so i could keep a note of how many people are in each set of postcodes. hopefully this makes sense and you can help me out
    ok so i have attached some of the postcodes that i have with what i want the output to look like. i want it so that i can search for all the postcodes on the left of the image through the 12 files with ease instead of manually searching for each one and transferring the outcome into excell. thanks for the help marc
    Attached Thumbnails Attached Thumbnails Untitled.png  
    Attached Files Attached Files

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Interesting, but what do the outputs represent? You gave a list of postal codes, but no data to search, group display..?
    Also, your postal codes have several characters --- mot=re than in your desired output.

    Need details about the search/matching and some sample data.

  7. #7
    Join Date
    Jan 2015
    Posts
    5
    Quote Originally Posted by orange View Post
    Interesting, but what do the outputs represent? You gave a list of postal codes, but no data to search, group display..?
    Also, your postal codes have several characters --- mot=re than in your desired output.

    Need details about the search/matching and some sample data.
    hi all im doing is in a query selecting postcodes in the criteria writing "like "E*****"" which then finds all the postcode that start with E then in the table that shows the output i see how many postocdes that match the critera and the put the result in the table. for example if you put the postcodes into an acess table and then run a query like i have just explained it will findyou all the postcodes with the criteria which is then what i put into excel i have tried to take screen shots of what im doing/ want to happenClick image for larger version. 

Name:	Untitled2.png 
Views:	14 
Size:	16.1 KB 
ID:	19390Click image for larger version. 

Name:	Untitled3.png 
Views:	14 
Size:	6.1 KB 
ID:	19391
    Attached Thumbnails Attached Thumbnails Untitled1.png  

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    OK. In plain English what does your query really represent?

    There may be ways to automate somethings, but you're going to have to provide something to work with...home and mobile etc.

    You need a plan or strategy if you want to reduce the manual effort, BUT we can't continue to guess at WHAT you're trying to do.

    You should be aware that your query with Like E* will not use any indexing and will be relatively slow.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    If you want to know how many records are assigned to each postal code letter prefix (A*, B*, C*, etc) can do an aggregate query that groups on that character position.

    SELECT Left([PostCode],1) AS PostGroup, Count(*) AS CountRecs FROM tablename GROUP BY Left([PostCode],1);

    If you need to group by single letter for some records and two letters (SE, SW, AL, etc) for others, this gets complicated.

    If you want to show detail information as well as summary calcs, then build a report.
    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.

  10. #10
    Join Date
    Jan 2015
    Posts
    5
    Quote Originally Posted by orange View Post
    OK. In plain English what does your query really represent?

    There may be ways to automate somethings, but you're going to have to provide something to work with...home and mobile etc.

    You need a plan or strategy if you want to reduce the manual effort, BUT we can't continue to guess at WHAT you're trying to do.

    You should be aware that your query with Like E* will not use any indexing and will be relatively slow.

    ok so what i am doing is searching the information that i have got. then im looking to see how many records meet the criteria. and then im taking the amount of records that match the criteria and putting it into an excel sheet. that is what im doing at the minute manually on all 33 postcodes and 12 different files. i want to know if there is a way that access can do that at once. you wouldn't need any more data as that is all im running my query on the postcode.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Did you read post 9?

    Why are there 12 tables? Are they identical in structure?

    What do the 3 number fields in your example output represent?

    Consider:

    SELECT Left([PostCode], IIf(IsNumeric(Mid([PostCode],2,1)),1,2) AS PostGroup, Count(*) AS CountRecs FROM tablename GROUP BY Left([PostCode], IIf(IsNumeric(Mid([PostCode],2,1)),1,2);
    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.

  12. #12
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Further to June's questions, it is the "... my query..." in

    i want to know if there is a way that access can do that at once. you wouldn't need any more data as that is all im running my query on the postcode.
    .

    So you have a whole bunch of postal codes that you want to query. But until we get some hint of WHAT you are try to find with the query, I have no idea what your issue is. How do you query postal codes of 6-8 chars in length and get values like OX 632 - without hinting or suggesting to the reader what this represents??

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Find query - help please
    By Johanb26 in forum Queries
    Replies: 5
    Last Post: 06-24-2014, 04:28 AM
  2. Query to find what isn't there
    By NISMOJim in forum Queries
    Replies: 4
    Last Post: 08-29-2013, 01:18 PM
  3. Replies: 3
    Last Post: 10-17-2012, 09:24 AM
  4. Validation for British postcodes
    By Helen269 in forum Database Design
    Replies: 7
    Last Post: 02-23-2012, 12:16 PM
  5. Can't Find Misspelled Query Name
    By jhillbrown in forum Access
    Replies: 5
    Last Post: 03-11-2010, 02:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums