lcWhere = "" IF some condition IF NOT EMPTY(m.lcWhere) lcWhere = m.lcWhere + " AND " ENDIF lcWhere = lcWhere + "some condition" ENDIF IF NOT EMPTY(m.lcWhere) lcWhere = "WHERE " + m.lcWhere ENDIF SELECT fields FROM table &lcWhere INTO...