Will Guest
|
Posted: Fri Nov 28, 2003 10:48 pm Post subject: TDBLookUpComboBox |
|
|
I'm using a TDBLookUpComboBox to get an ID from one table, to use as a
Filter on another table, whose contents then get displayed in a grid.
However, one of the ID's does not have a corresponding record in the table
to be displayed in the grid. Not a problem...or it shouldn't be. But
somehow, the TDBLookUpComboBox.KeyValue gets set to Null, and even by
selecting another item that does have a correspnding record, I can't get
back to a non-Null value.
The grid I am using is TMSSoftware's TDBAdvStringGrid, since it is the only
grid I have that allows me to easily check a value just before it is drawn,
and reformatting it the way I want.
Below is the code:
procedure TfrmItemSelector.luClientLookUpCloseUp(Sender: TObject);
begin
dmAssign.tblDetails.Filter := 'DCLIENTID LIKE ''%' +
luClientLookUp.KeyValue + '%''';
dmAssign.tblDetails.Filtered := True;
end;
procedure TfrmItemSelector.grdClientGetDisplText(Sender: TObject; ACol,
ARow: Integer; var Value: String);
var
d:TDate;
begin
if Value <> '' then
if (ACol = 2)and (arow > 0) then
begin
try
d := StrToFloat(Value);
except end;
Value := FormatDateTime('mmm dd, yyyy', d);
end;
end;
That's it. The IB components are in a data module and are set up at design
time(for now).
Thanks.
--
Will
|
|