Solved

DBLookupComboBox - Refresh

Posted on 1999-01-10
7
1,311 Views
Last Modified: 2008-03-17
How do I get a DBLookupComboBox to show the first record of the listsource when the Table is activated.

I've tried Table1.first but the dropdown still remains blank until I have first selected an Item.

If I have a parent table a select a record the I want the dropdown to now refresh and show the new detail records as per master table record.
0
Comment
Question by:smithsj1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 

Expert Comment

by:samone
ID: 1355683
Try to set the keyvalue to a value that is significant to your setting in keyfield.
You can try to set
DBLookupComboBox.Keyvalue:="firstvalue in table"

SAM 1
0
 

Author Comment

by:smithsj1
ID: 1355684
Samone do you mean

dblookupcombobox1.keyvalue:=table1.findfield('name').asstring;

Why doesn't Inprise just default th lookup to show the first record.
0
 
LVL 1

Expert Comment

by:adeng
ID: 1355685
Open the 'listsource' table before the table that use the value from listsource.

Table1.open; <---- Table that has a listsource
Table2.open; <---- Table that use a listsource value.

if you entering the correct value in DBLookupComboBox property then everything must be ok as expected.

But if you still insist that you have to open the table that contain listsource open after the second table than you must add this code :

procedure TForm1.Table2NewRecord(DataSet: TDataSet);
begin
    Table2ID.AsInteger := 1; // i assume that the first value of table1 is 1
end;

Inprise did make Dblookupcombobox show the first record.

Adeng.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:smithsj1
ID: 1355686
Adeng

Samone already answered the Q to my satisfaction.
0
 

Expert Comment

by:samone
ID: 1355687
Why did you reject my answer then?
0
 

Author Comment

by:smithsj1
ID: 1355688
Samone

I needed to confirm what you meant.

"Samone do you mean "

"dblookupcombobox1.keyvalue:=table1.findfield('name').asstring; "

" Why doesn't Inprise just default th lookup to show the first record."

Submit your answer again I'll accept it now!
0
 

Accepted Solution

by:
samone earned 50 total points
ID: 1355689
Yes if you have a stringvalue as keyfield its ok.
And if you know of a string that you always got at the top you only need to set DBLookupComboBox1.KeyValue:='Firstrecord';
But I rather use a index of integers in the first field in the database.

Like if I have a TABLE 'table1' with the fields
INDEX  NAME
1      BILL
2      JOHN
3      CHARLES

I use the index field as a keyfield and name as listfield
You set the DBLCB text field like this.

DBLookupComboBox1.KeyValue:=Table1.fields[0].AsInteger;

If you don't want to create the index numbers by yourself
you can use autoincrement (if you don't use Dbase).

SAM
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

707 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