Enable Code to work anywhere

C

Chase

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
 
C

Chase

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.
 
K

Klatuu

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.
 
C

chris.nebinger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top