I am using MS Access 2010.
I am creating code that will ultimately save the specified file from the SharePoint site to a local file.
I have a form where the user is required to provide the filename that is to be saved to a local drive. We are forced to use the file naming convention that is already defined and do not have the ability to change the naming convention.
Due to the fact that when retreiving the file from the SharePoint site, the file name cannot simply contain spaces but must be formated with "%20" where spaces exist, I am attempting to replace all spaces with the "%20". Here is what I am doing:
Please notice that in the value stored in the "strNetFileName" variable, the "05", which is the month part of the date in the original filename, has been converted to be "2005".
I have tried forcing the format of this "date" string to be a formated string but I have found no way to keep this value from being converted to the "2005".
I have tried to read only the left part of the filename (ST Flat file ) in to a variable using the InStrRev funciton and then read the right part of the filename "05_26_11" from the filename into another variable like this:
Again when the code is run the "strSecFileName" variable will contain the "2005" value.
Any suggestions for how to retain the "05" as part of the filename string would be appreciated.
I am creating code that will ultimately save the specified file from the SharePoint site to a local file.
I have a form where the user is required to provide the filename that is to be saved to a local drive. We are forced to use the file naming convention that is already defined and do not have the ability to change the naming convention.
Due to the fact that when retreiving the file from the SharePoint site, the file name cannot simply contain spaces but must be formated with "%20" where spaces exist, I am attempting to replace all spaces with the "%20". Here is what I am doing:
Code:
'declare variables
Dim strSecFileName as String
Dim strNetFileName As String
'read the filename provided by user in variable
strSecFileName = Me.txtSecurityFileName
'the line of code above stores the following string in the variable
' "ST Flat file 05_26_11"
'use the Replace funciton to insert the "%20"
strNetFileName = Replace(strSecFileName, " ", "%20")
'the line of code above stores the following string in the variable
' "ST%20Flat%20file%2005_26_11"
Please notice that in the value stored in the "strNetFileName" variable, the "05", which is the month part of the date in the original filename, has been converted to be "2005".
I have tried forcing the format of this "date" string to be a formated string but I have found no way to keep this value from being converted to the "2005".
I have tried to read only the left part of the filename (ST Flat file ) in to a variable using the InStrRev funciton and then read the right part of the filename "05_26_11" from the filename into another variable like this:
Code:
Dim strLeftStr As String
Dim strRightStr As String
Dim lngChrLoc As Long
lngChrLoc = InStrRev(strSecFileName, " ")
strLeftStr = Replace(strLeftStr, " ", "%20")
strRightStr = Format(Right(strSecFileName, Len(strSecFileName) - lngChrLoc), "mm_dd_yy")
'concatenate the left and right together
strSecFileName = strLeftStr + strRightStr
Any suggestions for how to retain the "05" as part of the filename string would be appreciated.