+ Reply to Thread
Results 1 to 4 of 4

access connection to 2 tables to find a common name in both tables

  1. #1
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    access connection to 2 tables to find a common name in both tables

    Hi all,

    I needed to build an excel macro that connects to a database with 2 tables. I can read and write to it. The thing I'm not able to do is to create a query that will take a name and check it in both tables and show the results in excel.
    Both tables are the same in layout, only the name is different. They are linked with the same field (ClientCompanyName). there is the field called (SurName). When I want to do a search, I type the surname in a search field (excel cell), press the button and finds that info, but don't know how to do it with 2 tables.

    Any clue how to do this?


    this is the code that I use for search:
    Please Login or Register  to view this content.
    If it can be adjusted to have it from 2 tables (it could like From Data And Data2 or similar)

    Greetings.

  2. #2
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: access connection to 2 tables to find a common name in both tables

    Hi all,

    No one has ideas?

    I just need to pull 2 times the rows that have the same last name.
    If I have in 2 tables a last name where one person is related to 2 different companies, it needs to show both rows from the 2 databases.
    so James Jones could be related in table1 to company X and in table2 to company Y, it will show both rows where I can see James Jones.
    How can I do this?

    Greetings.

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: access connection to 2 tables to find a common name in both tables

    Maybe:
    PHP Code: 
    SELECT [ID],[Analyst],[TypeHoliday],[DateFrom],[DateToFROM Data Where [TypeHolidayLike '%Some Term%'
    UNION ALL
    SELECT 
    [ID],[Analyst],[TypeHoliday],[DateFrom],[DateToFROM Data2 Where [TypeHolidayLike '%Some Term%' 

  4. #4
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: access connection to 2 tables to find a common name in both tables

    Hi Kyle123,

    Just what I needed :-)

    Big thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 12-24-2013, 10:48 AM
  2. Three of the tables in connection
    By arn0ldas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2013, 01:21 PM
  3. Tables from Data Connection
    By milty456 in forum Excel General
    Replies: 6
    Last Post: 10-08-2012, 10:25 AM
  4. Replies: 3
    Last Post: 12-24-2009, 07:14 AM
  5. MS Query cannot find tables in Access database
    By Dennis Cheung in forum Excel General
    Replies: 0
    Last Post: 07-07-2005, 12:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1