Set drive mappings by code on form?

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

Hi:
I have a simple Access2K app. setup to feed data to some
mail merge Word docs. Everything is mapped to the C:
drive (i.e. the buttons on the main form have hyperlink
addresses that open Word docs that are located in the C:
drive and likewise, the datasources of the Word docs are
looking for the Access file also in the C: drive etc.).
If I deploy the application to a computer that does not
have access to the C: drive, I have to reset everything
manually (lets say to the F: drive). Is there any way to
use a variable or something that would allow me to change
the drive letter for everything all at once? Thanks for
any help,
-Rick
 
The problem is that you have hard coded the refs.

I have working word merge example that runs from the "current" dir.

I don't use hyperlink to open the docs. However, if you move the application
to a different directory, or even a different drive, the code will still
work. If you copy the merge docs, then you do have to open the doc once and
hit save to update the path. It would be quite easy to even eliminate this
step.

Check out:

http://www.attcanada.net/~kallal.msn/msaccess/msaccess.html
 
Thanks. Your solutions would work well for many
scenarios. I guess my real question is: is there a way to
change the datasource drive mapping once the mail merge
document has been created (other than by opening the doc,
changing it manually, and resaving)? Thanks,
-Rick
 
Rick said:
Thanks. Your solutions would work well for many
scenarios. I guess my real question is: is there a way to
change the datasource drive mapping once the mail merge
document has been created (other than by opening the doc,
changing it manually, and resaving)? Thanks,
-Rick

Well, in my example code you never have to set the datasouce, since my code
does it for you. Of course, I specifically put some code in that when you
hit "modify" the template, it ALWAYS sets the datasouce (even when NOT
needed). I did this for when users do copy, or move templates to a different
dir. So, if my users do copy everything to a new dir, then they will have to
whack the modify template button and hit save. As I did mention, my merge
code could be easily modified to ALWAYS set the datasoucne when a mail merge
starts. However, I did not want to do this, as I thought the extra resources
used to set and "save" the document each time was not needed (since changing
the directory where the application run is a very rare occurrence). If
changing the dir was a common occurrence, then I suppose the extra code and
resources to set the merge path each time would be worth it. In my case, I
just tell the users that they can always whack the modify template button,
and then whack save...and the correct data source is thus set.
 
Back
Top