{$IFDEF
ADO}
oNummer:='[E-Mail]';
{$ELSE}
oNummer:='Adressen."E-Mail"';
{$ENDIF}
QU_Dublette.SQL.TEXT:='SELECT Adresse,Nummer,Suchbegriff,Firma1,Firma2,Vorname,Name,Strasse,Plz,Ort,Telefon,'+oNummer+' FROM Adressen';
QU_Dublette.SQL.Add('WHERE Art='+IntToStr(TabControl1.TabIndex)+' AND ((Ort LIKE '#39+StrToSQL(TBL_Kunden.FieldByName('Ort').AsString,TBL_Kunden.SERVER_TYPE)+
#39' AND Strasse LIKE '#39+StrToSQL(TBL_Kunden.FieldByName('Strasse').AsString,TBL_Kunden.SERVER_TYPE)+#39+')');
if Trim(TBL_Kunden.FieldByName('E-Mail').AsString)<>'' then QU_Dublette.SQL.Add('OR ('+oNummer+' LIKE '#39+StrToSQL(TBL_Kunden.FieldByName('E-Mail').AsString,TBL_Kunden.SERVER_TYPE)+#39')');
QU_Dublette.SQL.Add(')');
if Trim(TBL_Kunden.FieldByName('Firma1').AsString+TBL_Kunden.FieldByName('Firma2').AsString+TBL_Kunden.FieldByName('Name').AsString)<>'' then begin
QU_Dublette.SQL.Add('AND (');
if Trim(TBL_Kunden.FieldByName('Firma1').AsString)<>'' then QU_Dublette.SQL.Add('Firma1 LIKE '#39+StrToSQL(Trim(TBL_Kunden.FieldByName('Firma1').AsString),TBL_Kunden.SERVER_TYPE)+#39+' OR ');
if Trim(TBL_Kunden.FieldByName('Firma2').AsString)<>'' then QU_Dublette.SQL.Add('Firma2 LIKE '#39+StrToSQL(Trim(TBL_Kunden.FieldByName('Firma2').AsString),TBL_Kunden.SERVER_TYPE)+#39+' OR ');
if Trim(TBL_Kunden.FieldByName('Name').AsString)<>'' then QU_Dublette.SQL.Add('Name LIKE '#39+StrToSQL(Trim(TBL_Kunden.FieldByName('Name').AsString),TBL_Kunden.SERVER_TYPE)+#39+' OR ');
QU_Dublette.SQL.Add('1=2)');
end;
QU_Dublette.Open;
if QU_Dublette.RecordCount>0 then begin
// Doubletten gefunden
// Kunden eine Auswahl anzeigen ....