While I'm looking at this I would just draw your attention to another post I made elsewhere. I think it may help you.
Quote:
Originally Posted by NeoPa
It is always a good idea to ensure that variable name checking is enabled, AND your code compiles (at least compilation has been attempted), before submitting a question.
This avoids asking questions which are much more easily resolved on your own PC than on a forum.
To ensure variable name checking is enabled for all new modules, go to - Tools / Options / Editor (from the VBA Editor window) and set Require Variable Declaration to True (checked). For existing modules, ensure that the Option lines at the very top include :
To compile your project, select (again from the VBA Editor window) Debug / Compile
Project Name.
We
ARE generally happy to help with compilation problems too (If you find an error reported and you can't resolve it, let us know), but we do expect members to have tried compiling before submitting a question. That way we have a better idea of the sort of problem we're looking at.
Your line #6 is where it should be happening, but it rather looks like there is not much understanding there (Not a problem. We can help with that).
Can you tell me is [btnSearch] a control on your main form or the subform?