Using currentdb.name in Access 2007

DataMiner

Registered User.
Local time
Today, 20:52
Joined
Jul 26, 2001
Messages
336
I'm converting an Access 2002 database to 2007. A form in this db has a text box has it's control source set to
=[currentdb].[Name]

This works fine in 2002, but in 2007 just returns the irritating "#NAME?"

To add to my puzzlement, I've added a button to that same form (for debugging purposes) with the following code behind it's on_click event.
MsgBox Me.Text31.ControlSource
MsgBox CurrentDb.Name

Clicking the button gives me
=[currentdb].[Name]
and the path to my db, just as I expect.

It just doesn't work in the text box?

I can imagine several workarounds to this, but does anyone have any idea why this no longer works? I have made pretty extensive use of Currentdb.name in Access 2002 in footers on reports, etc. Should I expect to this to be an ongoing problem in converting to 2007?
 
Hmmm, wrapping it in a function seems to work. ANy idea why????
 
substitute 'CurrentDb.Name' with 'CurrentProject.Name'. This works with Access 2007, 2010 and 2013.
 

Users who are viewing this thread

Back
Top Bottom