Hi Joaquin, John's method works fine but the preferred way of doing it is using a Stored Procedure - it has the benefit of being able to modify the code without a recompile and also maintains the client / server architecture, jusy my two cents worth
Regards,
Peter J. Kane
Pete