Enable Code to work anywhere

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In the code below I had to stipulate the full UNC for "DoCmd.CopyObject" How
do I set this up to work anywhere.

Code
Dim StrBDM As String
Dim StrPath As String

StrBDM = ("qctb" & Forms![frmReportOps]![cboBDM])
StrPath = "\\admiral-srv1\data\VolumeDatabase\Reports\" & txtFileName &
".xls"
DoCmd.SetWarnings False
Me.Form.Requery
DoCmd.CopyObject "\\admiral-srv1\data\VolumeDatabase\ProcessReport.mdb",
StrBDM, acQuery, "qctbReport"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, StrBDM,
StrPath, True
DoCmd.DeleteObject acQuery, StrBDM
DoCmd.SetWarnings True
 
Work anywhere means local drive C:\ mapped server address P:\ or the full
server UNC \\XXX the mapped server address may very from PC to PC.
 
The site suggested to you is the best solution for this problem. It presents
a dialog box that will allow you to navigate to the file and select it. It
will return the full path and name of the file which you can use in your code.
 
Okay, I think I understand. You want to be able to convert drive
letters to the UNC names. Your example used UNC, so I didn't
understand your intentions.

http://www.mvps.org/access/api/

There is an example for converting mapped drives to UNC. However, the
local drive will not convert, because it is potentially placed in a
folder that isn't shared.

Let me know if you have any more problems.


Chris Nebinger
 
Back
Top