To use the example code I gave you need to do this first. It's one of those things that is so standard I skipped by it. I should also point out that I don't have a copy of Access handy, so there could be typos and other things I've overlooked.

Set db = CurrentDb()

Despite the fact that all Access code exists in the context of a database, Access does not give you a reference to the database by default. Thus the above is usually the first line of non-declare code in any significant Access VB routine.

I believe the reason for that has to do with the fact that you can create multiple database variable and access multiple databases through them. But Access really should give you access to the database the code is in through some default keyword.

Jay