Confused why system recognizes something


S

Steven

I have the following code that runs when this Database
starts. It is called from the OnOpen event of a form that
opens when the Database starts. This Sub's function is to
open another database and then close. I am doing this
because the other database is password protected.

Sub OpenAnotherDB()
Static acc As Access.Application
Dim db As DAO.Database
Dim strDbName As String
strDbName = "C:\TestArea\NewTestFile.mdb"
Set acc = New Access.Application
acc.Visible = True
Set db = acc.DBEngine.OpenDatabase(strDbName, False,
False,";PWD = NewTestFilePW")
acc.OpenCurrentDatabase strDbName
db.Close
Set db = Nothing
db0001.CloseDB '<-THIS IS THE QUESTION.
End Sub

My question is the db0001.CloseDB
If I type db0001. then many choices appear and I choose
CloseDB in this case. Why does it recognize the db0001.?
If I copy this Sub routine to another program it does not
recognize the db0001 and when I compile the module it will
error saying the db0001 does not exist. Why does it
exists in this file? Is there something else I am doing
that I do not realize?

Note: I would give better information here but I cant
because I dont really understand what is happening.

Thank you for your help.

Steven
 
Ad

Advertisements

S

Steve Schapel

Steven,

In the VB Editor window, have a look at the very top of the form module,
which is where variables can be declared for the whole module as against
for the specific subroutine. If there is no reference to db0001 there,
do a search of the whole project via the Edit|Find menu, and see if you
can track it down.
 

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