Link to home
Start Free TrialLog in
Avatar of smithsj1
smithsj1

asked on

DBLookupComboBox - Refresh

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.
Avatar of samone
samone

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
Avatar of smithsj1

ASKER

Samone do you mean

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

Why doesn't Inprise just default th lookup to show the first record.
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.
Adeng

Samone already answered the Q to my satisfaction.
Why did you reject my answer then?
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!
ASKER CERTIFIED SOLUTION
Avatar of samone
samone

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial