Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set db = CurrentDb Not Working for One User

Status
Not open for further replies.

DataChick

IS-IT--Management
Apr 17, 2002
108
US
I have an MS Access database front end that is being used by over 50 users. I have one user who receives an error when attempting to run the "Set db = CurrentDb" code.

He receives the error "Cannot Create Object" and when you click Debug it highlights "Set db = CurrentDB" in the VBA Code.

He has the same version of MS Access as everyone else. I even double checked to make sure he didn't change the references somehow and they are all the same. I cannot figure out what is different about this one users PC that causes him to be unable to use this code.

Any thoughts or suggestions are greatly appreciated.

Thank you in advance for your help.

"The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents."
-Nathaniel Borenstein
 


DC,

You might get better results posting in forum705.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I would check the references and unclick all that you can. Then reload the references to match your other databases. But I doubt that will fix anything but it is a try.

The currentDb function is a member of the Access.application object. You will be unable to even remove the reference, because it will be locked and in use. It returns a DAO.database object. So ensure that you have a reference to DAO. This is likely the cure see KB.


But I am not completely sure.
If you did not have a reference to DAO and everything else was working then these line would give a "User defined type.." error not a can not create object error

Dim db as dao.database
Set db = currentDB()

Simple test is type this in the immediate window
?currentDB.name

If all your references check, and you have a current reference to DAO. Then make sure you have all patches and updates. If that fails, I would reload Access.

What version?
 
Another way to return the currentdb is as follows

dim db as DAO.database
set db = Application.DBEngine(0).Databases(0)

Test that as well.
Test this in the immediate window
?application.DBEngine(0).Databases(0).Name
and see if it returns your db name.
 
Thank you for your advice. I will try that when I am able to get access to the users PC and let you know what happens.

"The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents."
-Nathaniel Borenstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top