Results 1 to 6 of 6
  1. #1
    softcrew2014 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    4

    Question Search from 3 tables and display result from 1 table

    Good day.

    I just need a little help in creating a query design or code. I have 3 tables (tranhead, trandetail, accountmaster) with the following fields below. I have a requirement where the user will enter a search and the query should look on 3 tables below and compare if the search criteria matches on below fields with red color. If there is a match the query should return whatever rows that matches in trandetail table. I have attached the database for reference. Thank you for helping.

    tranhead fields - accountno
    - accntname

    trandetail fields - tranno
    - accountno
    - debit
    - credit
    - remarks
    - slno

    accountmaster fields - tranno
    - trandate


    - docno
    - ....
    - ....
    - remarks
    Attached Files Attached Files

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Look at the like function with a query where all three tables are joined with criteria in the or rows of the design.

    Will the search word ever be a number? Date?

  3. #3
    softcrew2014 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    4
    thanks andy.

    the search word from the user will be a text or a string. I am still new to msaccess. please find attached db above. thanks.

  4. #4
    softcrew2014 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    4
    I have made a query to the database to come up the desired result. I dont know if this is correct. Please check my query in db attached. Thanks
    Attached Files Attached Files

  5. #5
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Something like this perhaps
    Attached Files Attached Files

  6. #6
    softcrew2014 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    4
    Thanks andy.

    Its very close to the desired result. But instead of returning only 1 row at a time, can we make it to return all rows with the same tranno in trandetail table?
    Example if the user will search "data", it should return all rows with the same tranno just like image below rounded in read. Thanks.

    Click image for larger version. 

Name:	snapshot.png 
Views:	7 
Size:	24.5 KB 
ID:	28911

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

Similar Threads

  1. Replies: 2
    Last Post: 11-08-2015, 03:44 PM
  2. Replies: 1
    Last Post: 03-26-2015, 11:08 AM
  3. Replies: 1
    Last Post: 06-25-2014, 01:05 PM
  4. Replies: 1
    Last Post: 04-11-2012, 03:30 PM
  5. Search in a table and display subform
    By smahdih in forum Access
    Replies: 2
    Last Post: 10-29-2011, 01:46 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