Solved

Use relative pathname in Excel Query to Access database

Posted on 2009-04-01
6
625 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
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:mikeopolo
Comment Utility
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
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
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 125 total points
Comment Utility
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
Comment Utility
This sounds like it should work in my case.  Thanks for sticking with it.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now