Avatar of Delores_C
Delores_CFlag for United States of America

asked on 

Adding filename and path on a report in Access 2007

I have used the code below to insert the database table name in a report, but it is not working in Access 2007.  Can someone please tell me the new code to use.

=[CurrentDb].[Name]
Microsoft Access

Avatar of undefined
Last Comment
Delores_C
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

=currentproject.FullName
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Where are you putting this value?

Have you tried:  =Currentproject.fullname
Avatar of Delores_C
Delores_C
Flag of United States of America image

ASKER

text box, source code
Avatar of Delores_C
Delores_C
Flag of United States of America image

ASKER

I tried putting your code in the text, report footer.  It did not work
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

strange, works for me.

Try this.  Replace the textbox with a label (lbl_database).

Then in the report footers Format event, try this:

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)

    Me.lbl_Database.Caption = CurrentProject.FullName
   
End Sub
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Are you displaying your report in Preview or Report or Layout view?
Avatar of Delores_C
Delores_C
Flag of United States of America image

ASKER

Preview

Still getting an error.  See exactly what I have entered and the message received

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    Me.lbl.Database.Caption = CurrentProject.FullName
End Sub

Error Message received “  A custom macro in this report has failed to run, and is preventing the report from rendering.”
 
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Delores_C
Delores_C
Flag of United States of America image

ASKER

Thanks, it worked
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo