the code i posted was based on ADO, if you want to use DAO you need to modify to suit