[Last Call] Learn how to a build a cloud-first strategyRegister Now


Show data on DBGrid from Different Tables

Posted on 2011-05-12
Medium Priority
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

ID: 35745303
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...

Expert Comment

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


Accepted Solution

kumaresan2011 earned 2000 total points
ID: 35746061

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

834 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