By using an If Then block of course. BOF and EOf are both properties of the RS object. There are literally 1,000s of examples plastered all over the internet.