Board index » delphi » Lookupfield and grid

Lookupfield and grid

I have an ADOQuery component with a lookup field pointing to another
adoquery field.
When the value of the key field is empty I see, in the grid, the first value
found in the lookup query.
How can I make the grid value empty if key field is empty?

thx
Simone

 

Re:Lookupfield and grid


You could write an OnGetText event for the lookup field you have created,
like this:

procedure TForm1.ADOQuery1LookUpFieldGetText(Sender: TField;
  var Text: String; DisplayText: Boolean);
begin
  if ADOQueryKeyField.IsNull then
    Text:= ''
end;

Karel

Quote
"simone" <sim...@nemnet.it> wrote in message

news:94k8pb$k7g$1@fe2.cs.interbusiness.it...
Quote
> I have an ADOQuery component with a lookup field pointing to another
> adoquery field.
> When the value of the key field is empty I see, in the grid, the first
value
> found in the lookup query.
> How can I make the grid value empty if key field is empty?

> thx
> Simone

Other Threads