473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

CurrentProject.Path Help

I'm very new to access and I'm trying to update a database that was created previously by someone else. The file path to a template that is being generated through access has been changed and I am attempting to update it.

I believe it is choosing the file based on this coding:

Set wdDoc = wdApp.Documents.Open(CurrentProject.Path & "\Templates\" & pGuideType & "_Template.lnk", , True)

If I'm understanding correctly, the CurrentProject.Path is the first part of the location of the file and 'templates' is just a sub folder within this location. The rest of the string, from my understanding, will not change since the names of the files will remain the same.

How do I change the 'CurrentProject.Path' to match the new location on our network?

Your help is greatly appreciated!!
Jul 1 '14 #1

✓ answered by NeoPa

KW:
How do I change the 'CurrentProject.Path' to match the new location on our network?
You put the Access file of the project in the folder you have the Templates folder in and run it from there.

11 5275
NeoPa
32,556 Expert Mod 16PB
KW:
How do I change the 'CurrentProject.Path' to match the new location on our network?
You put the Access file of the project in the folder you have the Templates folder in and run it from there.
Jul 1 '14 #2
twinnyfo
3,653 Expert Mod 2GB
kw127533,

NeoPa's answer is correct and will work. If you have db files in different locations which all use these templates (or a network location), I would use a global constant that indicates the directory name. Then the DB can pull that value at any time, regardless of from where the file is opened. For example, the DBs I build are opened from the user's local machine, although the directories I use for certain files are on a network drive.

Hope this helps.
Jul 2 '14 #3
NeoPa
32,556 Expert Mod 16PB
Indeed.

I haven't tried to guess what is most appropriate for your situation. My answer was in direct response to your question.

It may well be that your question wasn't the one you most needed help with, but I know too little to help with that. Twinny's comments may prove helpful and be worth considering.

As always, giving proper consideration to what you actually want is very important when asking for help. Generally more important than any answer when it comes.

Again, I don't know your situation so please don't think I have the cheek to criticise. This is merely general advice from someone with a deal of experience here.
Jul 2 '14 #4
The directory in which the original file was located no longer exists so I am getting an error when I run it. It allows you to browse the files on the network so that you can choose the appropriate file, however, I would like to automate this so the extra step of locating the template each time it is run is not necessary.
Jul 7 '14 #5
twinnyfo
3,653 Expert Mod 2GB
If you currently know the file location, the you can set this location in a separate module as a global constant, as described in Post #3. This would prevent you from searching for the location.
Jul 7 '14 #6
how would I go about doing that?
Jul 7 '14 #7
twinnyfo
3,653 Expert Mod 2GB
In a stand alone module, something like this:

Expand|Select|Wrap|Line Numbers
  1. Public Const gstrDBTemplates as String = _
  2.     "\\networkpath\networkfolder\Templates\
Then, you can use that string throughout your project when referring to your templates.
Jul 7 '14 #8
Rabbit
12,516 Expert Mod 8TB
The simplest solution is NeoPa's suggestion. Put the files in the same place. Is there a reason you can't just move the files back?
Jul 7 '14 #9
NeoPa
32,556 Expert Mod 16PB
I'm not sure why the OP has chosen to avoid replying to either of my earlier posts. Not overly happy about it, but I assume they are simply confused and believe it's best to ignore someone when you don't understand what they say. Not an approach I'd recommend, but for anyone else reading the question and wanting help then I will explain that there is a simple question here - which was answered directly in post #2, but there's also a similar, but different, question implied - which is how to handle accessing a file when it is in any folder, whether or not that is in the same place as the current project (CurrentProject.Path).

As there has been no clarification of what's required from the OP, in spite of the request for this, it seems sensible to cover both bases anyway.

The original question is properly answered in post #2. It isn't difficult or hard.

The alternative question is answered progressively, and perfectly adequately, by Twinnyfo in posts #3, 6 & 8. It includes the explanation as well as some illustrative code.

One can only assume that the OP has managed to get their project to work using this help as they haven't posted to confirm. In this case the absence of a response cannot be taken to indicate continuing difficulty (as it might in most circumstances).
Jul 8 '14 #10
As I stated in post #5, the directory in which the files were previously located no longer exists, therefore, I cannot move the new template into that location.

I currently have other projects I am working on and have not yet had time to try the solutions you have provided.
I will try creating a separate module as stated in post #8 and let you all know how it turns out.
Jul 8 '14 #11
Rabbit
12,516 Expert Mod 8TB
The core of the suggestion is to put both files in the same place. It doesn't matter where it is now. You can either recreate the directory and put both files in the same place. Or you can put the Access file in the new template location. Or you can put the template file in the new Access location.

My point is that it's preferable not to modify code if there's no need to.
Jul 8 '14 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Andrew Hearn | last post by:
Hi, I'm a bit of a newbie, seeking help on how to run a .php from the shell. I'm running debian, with Apache-ssl which is compiled with mod_php4. PHP for web sites works great. However, to...
5
by: Maria Joćo | last post by:
I have a table with one field that ia a hyperlink to a pdf file that opens a specific file. Since these files are very big, I would need to change the hyperlink path, so that I could send the...
7
by: dixie | last post by:
I have been running some code from a form's on open event to run regedit if a registry key does not exist in the registry. It has been working fine, but I have had the path to the registry fix...
2
by: Coy Howe | last post by:
This seems like it should be easy, but I can not figure it out. I have a file that I would like to open but I must open Acrobat first. Here is what I have tried: Call Shell(App.Path &...
2
by: dave | last post by:
Hi, I have a COM control / server I'm trying to get events from in my c# applications. 1) I'm trying to get events in both c# console apps and in c# winform apps. 2) I can call methods on the...
5
by: Michael | last post by:
Hi, For a home project I'm working on, I'm trying to get access to images within the web path, but the images don't show and I thing its because of the paths. Here is the dir structure: wwwroot...
2
by: Jason Gyetko | last post by:
I'm trying to open a file from VBA using a variable path and am not having very much luck. Can anyone help? This works: retval = Shell("""Excel.EXE"" ""C:\Program files\MyPath\MyFile.xls""",...
4
usafshah
by: usafshah | last post by:
hi I want a script which makes a folder (or u can say a shortcut) with UNC path like \\192.0.0.6\ImportantData
5
by: akirekab | last post by:
Can this be saved somehow in a field in the database along with some other address criteria, so I can always be looking at the current location. like this? ...
1
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, in my code behind i'm trying to get back to aspnet_client folder (that lives in C:\Inetpub\wwwroot\aspnet_client) can someone please show me the string path thtat will get me there and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.