Solved

DBLookupComboBox - Refresh

Posted on 1999-01-10
7
1,229 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
  • 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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.

706 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

14 Experts available now in Live!

Get 1:1 Help Now