Hi Marcus
Ich würds so machen:
strSQL = "SELECT DISCTINT * FROM Datenbank WHERE "
If len(name) > 0 then strSQL = strSQL + " Name like '%"& name & "%'"
if len(name) > 0 and len(vorname>0) then strSQL = strSQL + " OR";
if len(name) > 0 and len(adresse>0) then strSQL = strSQL + " OR";
if len(name) > 0 and len(plz>0) then strSQL = strSQL + " OR";
if len(name) > 0 and len(ort>0) then strSQL = strSQL + " OR";
If len(vorname) > 0 then strSQL = strSQL + " Vorname like '%"& vorname & "%'"
if len(vorname) > 0 and len(adresse>0) then strSQL = strSQL + " OR";
if len(vorname) > 0 and len(plz>0) then strSQL = strSQL + " OR";
if len(vorname) > 0 and len(ort>0) then strSQL = strSQL + " OR";
If len(adresse) > 0 then strSQL = strSQL + " Adresse like '%"& adresse & "%'"
if len(adresse) > 0 and len(plz>0) then strSQL = strSQL + " OR";
if len(adresse) > 0 and len(ort>0) then strSQL = strSQL + " OR";
If len(plz) > 0 then strSQL = strSQL + " PLZ like '%"& plz & "%'"
if len(plz) > 0 and len(ort>0) then strSQL = strSQL + " OR";
If len(ort) > 0 then strSQL = strSQL + " Ort like '%"& ort & "%'"
Hechel. Also das Beispiel dürfte Funktionieren. Eine leichtere Methode ist mir bisher nicht eingefallen.
Cu
Uwe