Using Name command in Access 2000

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

Guest

I have the following code, which I think is the culprit causing a "Bad
Filename" message box to pop up when I run code attached to a button.

Dim OtherFile As String
Dim PrepFolder As String
Dim ProcessedFolder As String
Dim OtherFolder As String

PrepFolder = """" & "x:\cs\nhr\name.xls" & """"
ProcessedFolder = """" & "x:\cs\nhr\PROCESSED\" & """"
OtherFolder = """" & "x:\cs\nhr\OTHER RECEIVED\" & """"
...........................
......some code.....
...........................

' culprit (?) below
NAME OtherFolder & OtherFile As ProcessedFolder & OtherFile
' Move the file once you're done with it

The debugger doesn't show this as an error and I've tested almost every
other option. Should I just go with a Copy and then Delete set of commands?

Thanks in advance for any pointers.
 
I have the following code, which I think is the culprit causing a "Bad
Filename" message box to pop up when I run code attached to a button.

Dim OtherFile As String
Dim PrepFolder As String
Dim ProcessedFolder As String
Dim OtherFolder As String

PrepFolder = """" & "x:\cs\nhr\name.xls" & """"
ProcessedFolder = """" & "x:\cs\nhr\PROCESSED\" & """"
OtherFolder = """" & "x:\cs\nhr\OTHER RECEIVED\" & """"
..........................
.....some code.....
..........................

' culprit (?) below
NAME OtherFolder & OtherFile As ProcessedFolder & OtherFile
' Move the file once you're done with it

The debugger doesn't show this as an error and I've tested almost every
other option. Should I just go with a Copy and then Delete set of commands?

Thanks in advance for any pointers.

Do you get paid by the quotes? <g>

PrepFolder ="x:\cs\nhr\name.xls"
ProcessedFolder = "x:\cs\nhr\PROCESSED\"
OtherFolder = "x:\cs\nhr\OTHER RECEIVED\"
 
I copied the code from another portion of my project. I don't remember
exactly why, but I needed the extra quotes to make the code work.

I originally had what you wrote, but it didn't work (but neither does what I
have right now)...so I'll go back to what I had (and you recommend) and try
again from there.

Thanks.
 
Your multiple quotes serve the purpose of adding a set of double quotes into
the string variable being generated. Doubling a delimiter character like a
quote mark is the traditional way of including the quote itself in the string
of characters generated, so the operating system will see

"""" & "x:\cs\nhr\name.xls" & """"

as "x:\cs\nhr\name.xls"
instead of x:\cs\nhr\name.xls

hence the bad file name error.
 
Back
Top