Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access.CurrentProject.Path Question - Copying app to computers

Status
Not open for further replies.

metrodub

Technical User
Dec 29, 2004
82
US
I have developed an Access database for my group and am in the process of copying the front-end to everyone's computer. The back-end is on a share drive which is mapped differently by every user.

I have a number of modules used in automating sending data to a Word template. This is the code I use to call the template:

Code:
Dim strMyTemplatePath As String
    strMyTemplatePath = Access.CurrentProject.Path & "\Consultant Templates\SOW.dot"

WordObj.Documents.Add Template:=strMyTemplatePath, NewTemplate:=False

When I run the form locally and click on the button that triggers the merge, everything works fine. The front-end that I use is housed in the same folder as the back-end on the share drive.

My issue arises when I put a copy of the front-end on other user's computers. I re-link the tables so it reflects their mapped share drive, but when I test the population of the Word templates nothing happens. Word opens, but nothing shows. If I go in and hard code the modules so that the path reflects each user's share drive path, everything works.

Why won't Access.CurrentProject.Path work on the other computers?

Thanks.
 
metro,
Another way to do this is to use the UNC (Universal Naming Convention) path to the backend. Instead of mapping a share on each user's drive, in the code, just refer to the path as

\\<servername>\<sharename>\<foldername(s)>\<filename.mdb>

This will work until you move the backend.

Tranman
 
Of course, what I meant to say was:
"Instead of mapping the share as a drive on each user's computer..."

Tranman
 
Maybe I am misunderstanding what you are saying.

Do you want me to re-link the back-end to this? Or do you want me to re-map everyone's path to the share?

If yes to the first question, how would I do this? I go to the linked table manager, but I can't see where I can change the path to the UNC.

Thanks.
 
Let's say that you go to User A's computer and hard code the path as "T:\CONSULTANTS\Consultant Templates\SOW.dot" and everything works fine.

On user B's computer, instead of T:\ they've mapped the same physical location as "R:\CONSULTANTS\Consultant Templates\SOW.dot" so you go in and hard code that location, and everything works fine there, also.

What I'm saying is that the physical location has a "universal" name that is the same for all users. If you hard code that universal name (something like: \\myServer\CONSULTANTS\Consultant Templates\SOW.dot), and don't try to use currentproject.path, then everyone will be able to access the location via that "universal" name, regardless of any drive mapping they may or may not have.

Tranman
 
That's what I thought you meant. I tried this and get the same issues as before.
 
Going back to the original question:

"Why won't Access.CurrentProject.Path work on the other computers?"

When you install the frontend on the users' local machines, then the Access.CurrentProject.Path reflects the place on the LOCAL machine where the frontend is located, not where the backend/physical tables are located.

If your template(s) are not in the same location as the frontend on the local machine(I assume you only have one copy of the template(s), located on the server), that's why you would not be able to set the template property of the WordObj document, using Access.CurrentProject.Path.

As to why you CAN'T use UNC for a path that you CAN code with a drive letter, I have no idea. The only time I've seen that happen is in old QBasic or COBOL code.

Have you tried putting a breakpoint/debug in your code at the point where you set the template property, and seeing what it's being set to?

Tranman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top