Prova così: (spero di non aver fatto str***ate :P)
codice:
SQL = "SELECT * FROM tabella"
if CognomeNome<>"" or Comunenascita<>"" or DataNascita<>"" then
SQL=SQL& "where"
end if
if Comunenascita<>"" then
SQL=SQL& "Comunenascita like '%" & Comunenascita & "%'"
end if
if Comunenascita<>"" and CognomeNome<>"" and DataNascita<>"" then
SQL=SQL& "and"
end if
if Comunenascita<>"" and CognomeNome<>"" then
SQL=SQL& "and"
end if
if Comunenascita<>"" and DataNascita<>"" then
SQL=SQL& "and"
end if
if CognomeNome<>"" and DataNascita<>"" then
SQL=SQL& "and"
end if
if CognomeNome<>"" then
SQL=SQL& "CognomeNome like '%" & CognomeNome & "%'"
end if
if DataNascita<>"" then
SQL=SQL& "DataNascita like '%" & DataNascita & "%'"
end if