Solved

Master-Detail Problem

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

22 Experts available now in Live!

Get 1:1 Help Now