str1 = "SELECT DISTINCT tblUsers.Email,tblUsers.Ime, tblUsers.Prezime..." - this a long SQL string
str2 = Nz(Forms!frmMain.txtSQL, "")
b = InStr(str1, "order")
If Len(str2) = 0 Then
b = InStr(str1, "order")
str1 = Mid(str1, 1, b - 1)
str2 = " where email <> ''...