Access 2007 Current Path string

I have the following string on an Access 2003 form which displays the path of a file, but for some reason when I run this form in 2007 I get the #?Name error message.

Is there syntax I am missing for 2007?

=Mid(CurrentDb.TableDefs("COMBINED").[Connect],InStrRev(CurrentDb.TableDefs("COMBINED").[Connect],"=")+1)+"\COMBINED.txt"
szadrogaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Helen FeddemaCommented:
Here is the syntax for getting the path of the current database:

strDBPath = Application.CurrentProject.Path & "\"
0
Helen FeddemaCommented:
If you are looking for something else, please clarify.
0
szadrogaAuthor Commented:
I am looking to return the location of a currently linked table named "COMBINED"  which is located in the current DB
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Jeffrey CoachmanMIS LiasonCommented:
SELECT Database
FROM msysObjects
WHERE Name='Combined';
0
Jeffrey CoachmanMIS LiasonCommented:
Or:...
SELECT Database
FROM msysObjects
WHERE Name="Combined";
0
Jeffrey CoachmanMIS LiasonCommented:
Sorry again...

Use this as the controlSource of a textbox:

=DLookUp("Database","msysobjects","Name='Combined'")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
szadrogaAuthor Commented:
Works perfectly, thanks for your help.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"but for some reason when I run this form in 2007 I get the #?Name error message."

Using CurrentDb, Environ() & RecordsetClone (and possibly others) no longer work in expressions used in the Control Source of a text box starting with A2007.  It's unclear if this is a bug or these were never supposed to work and Microsoft simply 'tightened' things up.

So for example
=Environ("UserName")  will result in #Error.

Use the example give by boag2000 above.  That will work.

mx

0
Jeffrey CoachmanMIS LiasonCommented:
Thanks Joe
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
:-)
0
Jeffrey CoachmanMIS LiasonCommented:
szadroga,

The "Connect" field may also be of interest...
...especially with ODBC linked tables

You can also narrow the search by Filtering for TYPE=6
Which will only give you "Linked tables"

You could have probably retrieved this data by loading the control via code:
Me.txtPath=CurrentDB....
...as many developers do not like to query the Msysobjects table directly.
Sometimes I use it because the SQL syntax is easy to remember...

;-)

jeff

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.