link a table using virtual path instead of hard coded path?

Infiltrator64

Board Regular
Joined
Dec 19, 2004
Messages
63
I want to make my database portable so a user can put it in any folder they would like. I will have a folder called Database that they will always run the database from however I don't care where they put it on the local or network drives.

I simply want it to look in the folder that the database was opened in for any links.

I currently have one table I need to link to which will be in the Database folder. The only way i can figure out how to link it is with a fixed path of c:\database.

Can this be done? Something like %path%\Database
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
infiltrator.

if your users are always running the database from the folder containing your link, could you use CurDir or ActiveWorkbook.Path?

ben.
 
Upvote 0
sweater_vests_rock


That sounds like what I want to do however I'm not sure how to do it. When I link a table I browse to the file location. I don't know how to edit the path so it starts in the current directory instead of looking for a hard link like c:\database.

I just started to use and learn access yesterday so I obviously am a rookie with access and may need to be guided by the hand initially.

:oops:
 
Upvote 0
infiltrator.

I'm talking about commands in the VBEditor. Ignore my ActiveWorkbook.Path -- that is an Excel command. However, CurDir will return the folder which contains your database.

So, if you are linking via VB, you can use the value CurDir returns to guide you to the folder containing the database and the linked table. Because I don't use Access, I'm not sure if there is a way to do this outside of VB.

Ben.
 
Upvote 0

Forum statistics

Threads
1,221,877
Messages
6,162,583
Members
451,776
Latest member
bosvinn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top