*** Set the query to be ran asynchronously SQLSETPROP(sqlHandler, [Asynchronous], .t.) IF SQLEXEC(sqlHandler,....,[crsCursorThatReceiveResultSet]) < 0 && Your long query AERROR(laError) MessageBox([Query can not be ran ]+laError[1,2]) SQLSETPROP(sqlHandler, [Asynchronous], .f.) RETURN ENDIF .... && There where you first time need the result of that query: IF NOT USED([crsCursorThatReceiveResultSet]) && Query still runs *** Do something RETURN ENDIF SELECT crsCursorThatReceiveResultSet GO BOTTOM && Force whole resultset to be received. ....Don't forget to reset back [Asynchronous] for this sqlHandler.