DB Reference - Dim statement

M

MJatAflac

I am trying to run a procedure in one database from a different database. I
have the db referenced in the library so that I can call it from the current
db. It works great until I get to a place in my code that refers to the db as
currentdb(), in other words as soon as I hit

dim db as database
set db = currentdb()

I begin to get item not in collection issues... I assume this is because vba
is looking for them in the wrong db because of the currentdb reference. How
do I get around this?

Thanks,
 
M

MJatAflac

That worked great! Thanks for the tip.
One last question... I know you can declare the database once in a module so
that you don't have to keep doing it every time you use something in it's
collection. I'd imagine it's done in the declarations section of the module
but I can't find an example of the syntax anywhere in the help system. Can
you help with this?

Thanks again for the help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top