OK, rather than try and resolve your problem by guesswork on what you are trying to do I will post a copy of the Search 2000 database by Allen Browne to see if the code he uses will give you what you need, it could be something as simple as a missing appostrophy etc.
Or possibly using a function rather than plain VBA.
Other than that I would need a zipped dummy copy of the database (less any personal data) to look at the form and code.