Results 1 to 7 of 7
  1. #1
    Russellh is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    68

    If I have a list (excel for ex) of data, How do I use that query data from tables in access

    For example I have 100 customer numbers on a spreadsheet in excel from some report I've run.


    In my access database there exists tables that have the customer number as one of their fields and other information that I need..
    I need to know what the normal process is for building that query with out a mile long "or" statement in the customer # field that would pull the info I need for just these customer numbers.

    So where I would normally make a query and include all the tables and link them up and I would select "customer number" and from Table 1 "address", "phone" and from Table 2 "balance" and so on, and I would pull all the customer information for all customers I just want query this info for only the customer numbers that I have listed on my spreadsheet.

    I could create a Temporary Table in the database and upload the 100 customer numbers in it and then link it query design. Then I would change the join to show all the records that exist in the temporary table and only those that match in the other tables.
    If that process would work is that the normal method or best practice, keeping in mind I know so little visual basic programming that I wouldn't consider that an option unless it was the only way.

  2. #2
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Do your Customers have a unique CustomerID assigned to them? Please show your table structure and a set of sample records with field name headers.

  3. #3
    Russellh is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    68
    Click image for larger version. 

Name:	Query Design.jpg 
Views:	15 
Size:	141.5 KB 
ID:	28084Click image for larger version. 

Name:	Query Result.jpg 
Views:	15 
Size:	182.7 KB 
ID:	28085

  4. #4
    Russellh is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    68
    Yes they are unique. So I have the query built above and this is just an example. I may do this for any number of queries or fields. So in addition to this setup I have a list in excel of the 100 customers that I need to pull this query for.
    I could put some huge "OR" statement under the "MBRSEP" field. I could also create a TEMP TABLE and upload the "MBERSEPS" in table and then add that table to the query with the join I mentioned to only pull those 100 customers.

    Which is the best / preferred practice without VB programming. So I may do this in a totally different query for location information with a list of specific locations. I understand the the data type would have to be the same and in the same format as how its stored in the table.
    I just would like to know how to do this for querying in general rather than specific results for one I am doing right now.

  5. #5
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    I understand better now. Have you tried to link to the Excel sheet from MS-Access and make a query joining the Excel sheet with your other applicable table(s)?

  6. #6
    Russellh is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    68
    No, I'm not sure how to link a spreadsheet. Would that be the normal method to do what I am trying to do?

  7. #7
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    To link to an external file, go to the External Data menu/Import & Link. Select the file type - in your case Excel. A wizard will begin, follow the instructions. From there you can treat this the same as any other table, include it in queries etc.

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

Similar Threads

  1. Replies: 1
    Last Post: 10-16-2014, 10:36 PM
  2. Update Existing Access Tables with Data from Excel
    By ChelseaC in forum Import/Export Data
    Replies: 7
    Last Post: 08-10-2014, 04:28 PM
  3. Importing Excel Data Tables into Access
    By Itch in forum Programming
    Replies: 5
    Last Post: 09-08-2012, 11:27 AM
  4. Replies: 3
    Last Post: 02-13-2012, 12:20 PM
  5. Import Excel Data to Multiple Access Tables
    By colby in forum Import/Export Data
    Replies: 3
    Last Post: 11-04-2011, 12:17 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