Solved

Master-Detail Problem

Posted on 1999-01-01
3
241 Views
Last Modified: 2010-04-04
When the user moves to a new record in a DBGRid via the DBNavigator, mouse click, or using the up and down arrow keys of the Master table, the Detail table DBGrid displays the correct records.  What I want to do is display some information in a TPanel based on what the current record in the Detail table is whenever the user moves to a new record in the Master.  I have gotten this to work if the user uses the DBNavigator, but nothing else.

What I need is the code to make this work.

Thanks for your help.
0
Comment
Question by:tecmaster
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
adeng earned 150 total points
ID: 1354174
Hi, i hope i don't miss understand what do you mean. Try to use OnDataChange on DataSource Component of Detail Table.

procedure TForm2.DataSourceDetailTableDataChange(Sender: TObject; Field: TField);
begin
     Panel1.Caption := DetailTableNAME.AsString;
end;

Regards, Adeng
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1354175
hi tecmaster,

when mastertable- and masterfields-propertys in your detailtable are probably set, and a datasource is connected to your detailtable, so you can use dbeditfields connected to the datasource of your detailtable in your panel .

The fields display the first detailrecord by moving in the mastertable automatically.

if you want to show how many detailrecords are available depending on your mastertablerecord, you can do it with this.

procedure TForm1.YourMasterDataSourceDataChange(Sender: TObject; Field: TField);
begin
  edit1.Text := inttostr(YourDetailTable.RecordCount);
end;



meikl
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1354176
hi tecmaster,

my braindictionary failed
i mean properly instead of probably

meikl
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Path  to current project in Delphi. 2 79
Press three keys together and trigger a function 3 56
creating threads in delphi 1 101
Delphi...Split view - idea? 1 67
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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