Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Use relative pathname in Excel Query to Access database

Posted on 2009-04-01
6
Medium Priority
?
637 Views
Last Modified: 2012-05-06
Is there a way to make the reference to the database name a relative path rather than a fullpathname starting at the C: directory,. In this sample I want to have Source=V3.0 PMW 160 Master Plan.mdb instead of starting with the C: directory.  If I put that in, it gets converted to a full pathname

Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\PMW 160 Plans\V3.0 PMW 160 Master Plan.mdb;Mode=Share Deny Write;Extended Properties="";Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False
0
Comment
Question by:StevenPMoffat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:mikeopolo
ID: 24045836
To my knowledge, no. I'm saying this based on experience with various other connection strings for different database files, where the name of the database always requires the full path and filename.

May I ask why you would want this?

Regards
Mike
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 24046885
might be possible, you could try this

'Change directory to where path of xls file is
chdir("C:\PMW 160 Plans")

'Open xlsfile using relative path

0
 

Author Comment

by:StevenPMoffat
ID: 24056477
For Mike:   I have a spreadsheet that is linked to an Access database file.  I want to pass them around to a number of individuals together and not have them have to change the pathname in the query.  

For Rock.  I setup the link in Excel to Access by using the Connection box of the Edit OLE DB Query box so I don't know if your recommended commands would work?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 65

Expert Comment

by:rockiroads
ID: 24088295
What about using ODBC then. Each user will have to create an ODBC entry on their PC. This will point to the database.
Then see if you can connect via ODBC instead
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 24088313
Forgot to add, the ODBC approach uses a common name, Excel doesnt worry about the path. Not sure from using Edit OLE DB Query box, you can use ODBC or if there is some other way to acheive what you want
0
 

Author Closing Comment

by:StevenPMoffat
ID: 31565613
This sounds like it should work in my case.  Thanks for sticking with it.
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question