When you delete an ad-hoc query, any selections you created based on it are also deleted. If a query (or selection based on it) is in use anywhere in the program as part of a process or other functionality, the query cannot be deleted. If you attempt to delete a query that is in use, a message appears to inform you that the operation is not allowed.