Problem concatenating strings in VBA module code

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

Guest

Hi,

I need to append to one string this small string "\*" and it works in one
place in my code and doesn't in another. Here is what I do:

Dim sSubDir As String * MAX_PATH ' where MAX_PATH is defined as 260
Dim sSearchSubDir As String * MAX_PATH

' append wildcard to get all files and sub-directories
sSubDir = sDirName & "\" & FindData.cFileName
sSearchSubDir = sDirName & "\" & FindData.cFileName & "\*"

I haven't a clue what the issue is and what, if any workaround there is.
Can somebody tell me how to get this to work? This is for VBA 6.3 running in
Access 2000 or thereabouts.

Thanks,

Elisha Berns
 
There's nothing obvious wrong with that code. So the odds are that you
aren't doing what you /think/ you are doing.

Add debug.print statements to show the value of each string before the
append, and the result, after the append. Then post your code
/verbatim/, together with the output of the debug.prints. You've made
some kind of simple error. String appends do not, "not work"! But it's
hard to tell what error you've made, unless you give more info as
suggested.

Changing "\" to CHR(92) will not make any difference.

HTH,
TC
 
Back
Top