Solved

Master-Detail Problem

Posted on 1999-01-01
3
240 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

943 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

10 Experts available now in Live!

Get 1:1 Help Now