I have a 3 character fkLookup field sat_site in a table. I'm using TAdsTable table component. When I filter out records in my grid on a field sat_site, grid does not show any records. With ShowMessage() I check the value of field sat_site which shows blanks or boxes in the message pop-up. Following is my source code:
procedure TfrmMain.tblSaturdayFilterRecord(DataSet: TDataSet; var Accept: Boolean);
begin
if frmSatOffDays.Edit7.Text <> '' then
begin
ShowMessage(tblSaturday.FieldByName('SAT_SITE').AsString); // checking value
if (DataSet['sat_month']= frmSatOffDays.Edit9.Text) and (tblSaturday.FieldByName('SAT_SITE').AsString = frmSatOffDays.Edit7.Text) then
begin
Accept := True;
end
else
begin
Accept := False;
end;
end
else
begin
if tblSaturday.FieldByName('sat_month').AsString = frmSatOffDays.Edit9.Text then
begin
Accept := True;
end
else
begin
Accept := False;
end;
end;
end;
Following are the properties of the field sat_site:
Alignment taLeftJustify
AutoGenerateValue arNone
DisplayLabel SAT_SITE
DisplayWidth 3
FieldKind fkLookup
FieldName SAT_SITE
Index 3
KeyFields SAT_HONO
LookupCache False
LookupDataSet tblMasterFileDBF
LookupKeyFields HONO
LookupResultField tblSaturdaySAT_SITE
ReadOnly False
Required False
Size 3
Transliterate True
Visible True
I have tried replacing field name of SAT_SITE in the event by tblSaturdaySAT_SITE.AsString but the result is the same. Can anyone help me?
Thanks and best regards.