CurrenDB.Name does not work in Access 2003?

F

FUBARinSFO

Hi:

Desigining a footer in Access 2003 report, I've worked out with VBA to
put fully-qualified path and file name in the footer, along with the
name of the data table it is referencing (code below).

This does not use the '=CurrentDb.Name' suggested by a number of
postings in this group. When I place '=CurrentDb.Name' in a text box
(which changes to '[currentdb].[Name]' and run the report, I get a
text input box "Enter Parameter Value" for 'currentdb'.

Clearly it does not recognize the built-in variable 'CurrentDb' Why
is that?

Thank you in advance for your help.

-- Roy Zider

This is VBA code:
-------------------------------------------
Option Compare Database

Function MyPath() As String
' 7/22/2010 lsz
' this gives full dpfname

MyPath = CurrentProject.FullName

End Function
-------------------------------------------

This is in text box on page footer:
-----------------------------------------------

=MyPath() & " [" & [Name] & "]"
-----------------------------------------------

System information on Microsoft Access 2003
-------------------------------------------------------------------
Application name Microsoft Access
Version 11.0
Build 8166
Product ID 73931-640-4055412-57901
Application path C:\Program Files\Microsoft Office\OFFICE11\
Language English (United States)
ADO version 2.8
VBA version 6.05
References VBA, Access, stdole, DAO, ADODB
Database name dbVO23.mdb
Database path D:\D\DandS\BitBucket\MyDox\_OWL\Accounting 2\Dox\2.
Verified Objections
Database size 1268.0 KB
Database create date 7/19/2010 20:15:58
Current user Admin
Jet version 4.0
 
F

FUBARinSFO

Allen:

Evidently not.

Using your expresson ' =[CurrentProject].[FullName]' in the Data/
Control Source box of the text box properties sheet throws error

"Syntax error in query expression 'First([=[CurrentProject]].
[FullName])'.

Stripping the brackets and using '=CurrentProject.FullName', it throws
an Enter Parameter Value input box with the full string
'CurrentProject.FullName', so it doesn't recognize either of these
vars.

-- Roy
 
D

David W. Fenton

m:
Evidently not.

Using your expresson ' =[CurrentProject].[FullName]' in the Data/
Control Source box of the text box properties sheet throws error

"Syntax error in query expression 'First([=[CurrentProject]].
[FullName])'.

Stripping the brackets and using '=CurrentProject.FullName', it
throws an Enter Parameter Value input box with the full string
'CurrentProject.FullName', so it doesn't recognize either of these
vars.

What about qualifying it properly:

Application.CurrentDB.Name
Appication.CurrentProject.FullName

If that doesn't work, I guess you'll have to write a UDF wrapper
around one or the other of them.

Bummer. There's been a slow decay in the scope of the expression
service starting with A2000, and this looks like yet another example
if the fully-specified versions don't work.
 
A

Access Developer

Interesting... I just tried =CurrentDB.Name as the Control Source of a Text
Box in the Report Footer of a Report in Access 2003. It did add brackets to
the Control Source, =[CurrentDB].[Name], but returned the fully qualified
name of the current database. Moving that Text Box to the Report's Page
Footer also worked just fine.

I'm wondering, when you wrote about Access adding the brackets, you used an
all-lowercase currentdb rather than the CurrentDB you had typed earlier. If
it is changing the capitalization, you should make certain you haven't
defined a variable "currentdb" anywhere in your database.
 
Joined
Aug 10, 2011
Messages
1
Reaction score
0
I think this may be partly an OS issue... just fixed it in an Access 2003 app we've had running for years under XP with no problems using CurrentDB.Name on a report header. I just started getting the parameter input box running the app under Win 7, where of course I also have Access 2010 installed and thus get weird behavior (including what I like to call the "preparing to install" virus every time I switch from 2003 to 2010 or back...). I had to change to CurrentProject.Name to get it to work under Win 7. Hmmm...
 

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