Full Pathnames

G

Guest

Good afternoon
I have several IS Managers throughout the company that I would like to use my application. They each will be producing their own data import file for Access using Excel or .txt format. Each division (19 of them) has a 2 letter abbreviation. I am working with docmd.transfertext and cannot get the full pathname to the file to work

Here's the code

Option Explici
Public Sub Command1_Click(
Dim divID As Varian
Dim tablename As String, pathname1 As Strin
divID = InputBox("Enter your division abbreviation (XX):"
tablename = "'tbl'&divID&'Orders'
pathname1 = "'x:\common\derek\tbl' & divID & 'Orders.txt'
DoCmd.TransferText acImportDelim, "tblOrdersData", tablename, pathname

The error I get is that "x:\common\derek' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides

I've tried this, I've tried putting the file on my C: drive, I've tried using the NTcomputerID and path \\mcsxx\whatever\whatever to no avail. I've checked the ng, the help files, and The Accessweb to no avail. Can someone please give me a hand

Thank you
Derek
 
G

Gerald Stanley

The presence of double and single quotes may be giving a
problem. Try
pathname1 = "x:\common\derek\tbl" & divID & "Orders.txt"

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Good afternoon,
I have several IS Managers throughout the company that I
would like to use my application. They each will be
producing their own data import file for Access using Excel
or .txt format. Each division (19 of them) has a 2 letter
abbreviation. I am working with docmd.transfertext and
cannot get the full pathname to the file to work.
Here's the code:

Option Explicit
Public Sub Command1_Click()
Dim divID As Variant
Dim tablename As String, pathname1 As String
divID = InputBox("Enter your division abbreviation (XX):")
tablename = "'tbl'&divID&'Orders'"
pathname1 = "'x:\common\derek\tbl' & divID & 'Orders.txt'"
DoCmd.TransferText acImportDelim, "tblOrdersData", tablename, pathname1

The error I get is that "x:\common\derek' is not a valid
path. Make sure that the path name is spelled correctly
and that you are connected to the server on which the file
resides.
I've tried this, I've tried putting the file on my C:
drive, I've tried using the NTcomputerID and path
\\mcsxx\whatever\whatever to no avail. I've checked the
ng, the help files, and The Accessweb to no avail. Can
someone please give me a hand?
 
D

Douglas J. Steele

If there's a need for quotes around the path (such as if you were going to
x:\my documents\... rather than x:\common\..., or if divID can contain a
blank), try:

pathname1 = Chr$(34) & "x:\common\derek\tbl" & divID & "Orders.txt" &
Chr$(34)

or

pathname1 = """x:\common\derek\tbl" & divID & "Orders.txt"""
 
Top