Results 1 to 4 of 4
  1. #1
    pirseinkim is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    3

    Question Producing a search from several tables

    I need to create a search database. We recently purchased a US Database that has several companies for each state in their own table. So I have 51 separate tables. Each table can contain anywhere from 40,000 - 1,700,000+ records. So what I need to do is, on my screen create fields from which I would like to search ie) company name, industry, state. Some of these fields will be able to search on partial description. In general, I would create a query and perform the search. Simple. But how would I go about doing this? I need to search every table. So for example if I typed in 7-11 in the company and in the state of TX. I would like to search the TX table for all 7-11's. That doesn't seem so hard, however, what if I put that I wanted to see all 7-11 stores (for every state). I cannot create a query that will hold all that data. Either I'm over thinking this or I'm lost! Any help is greatly appreciated. Hopefully I explained it well.



    Thanks,
    Kim p

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Options:

    1. combine all 51 tables into a single table

    2. use a UNION query to emulate a single table - there is a limit of 50 lines in a UNION

    3. use VBA code to run INSERT SELECT sql action and write records from each table into a 'temp' table which is purged before each search process
    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.

  3. #3
    pirseinkim is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    3
    If I create a union query and combine all 51 tables won't it take a while to run? My thought was to create queries for each state because there are select fields I would like to use only. Then create my union query. However, by creating a union query, is it faster for it to read though every field in each table or using the queries that I create? Does that make sense? So with that said, which way is reccommended for a quicker response?

    Thank you,
    Kim P

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    UNION has limit of 50 lines (50 tables), you have 51. A UNION query can pull only the fields specified.

    I don't know how fast or slow for any type of query involving millions of records.

    How would you present to the user the results of searching 51 queries? Possibly the VBA and temp table approach is your only recourse.
    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.

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

Similar Threads

  1. HELP Subform is producing multiple records
    By VeganLiving in forum Forms
    Replies: 7
    Last Post: 08-21-2013, 12:00 PM
  2. Producing A Schedule
    By dylcon in forum Access
    Replies: 11
    Last Post: 06-14-2013, 01:36 PM
  3. Help producing queries
    By skidia in forum Access
    Replies: 1
    Last Post: 05-13-2013, 12:21 PM
  4. Producing a stand-alone Access Program
    By GordonT in forum Access
    Replies: 3
    Last Post: 08-20-2012, 02:23 PM
  5. Queries & Macros aren't producing results after system crash
    By Nashskye13 in forum Database Design
    Replies: 2
    Last Post: 06-07-2012, 03:12 PM

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