Show data on DBGrid from Different Tables

Posted on 2011-05-12
Last Modified: 2012-05-11
Hi  all,

I have a problem. I'm using ADO connection to access an MS Access database and then show it on a DBGrid.

The MS Access Database has many tables and some fields are linked to get the data to populate the dropdown selection.

All the tables are related by 1 field too.

How do I get the proper data to display on the grid from different tables?

I also use ADOTable pointing to the main table but no other tables.

Can can I get this to work please?


Question by:error77
    LVL 26

    Expert Comment

    construct the sql query to get the proper data from the related tables and use a ADOQuery to get the data. and direct the data source of the grid to the query component. In such a case you cant do updates within the grid, you can just list the result...
    LVL 9

    Expert Comment

    This tutorial to add Drop down list inside a DBGrid like this

    LVL 5

    Accepted Solution


    1, u have to construct you query
      for example table 1 - PARTS & table 2 - ITEMS
    so write query like this
    select items.*,Parts.* from items,Parts where Parts.PartNo = items.PartNo

    add this query in tquery and execute. and set query dataset on datasource and assing datasource to dbgrid.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now