Hi all,
Any help would be greatly appreciated, but I am trying to rename a folder using a couple of DB object variables and I'm having a tough go at it. I have tried to convert the objects to strings, but have found out that that doesn't really work.
My object variables are:
Dim Value1: Set Value1 = CreateObject("ADODB.Recordset")
Dim Value2: Set Value2 = CreateObject("ADODB.Recordset")
Set Value1 = connection.Execute("SELECT MAX(RUN_NUMBER)...")
Set Value2 = connection.Execute("SELECT RUN_CLIENTID...")
My object folder is the newest folder in:
Dim objFolder: Set objFolder = objFSO.GetFolder("C:\Program Files\Doc_Finder\Docs")
I find the newest with the following:
For Each objFolder in colFolders
If objFolder.DateCreated > dDate Then
dDate = objFolder.DateCreated
strNewestFolder = objFolder
End If
Next
WScript.Echo strNewestFolder
and finally I'm trying to rename the newest folder with the following statement:
fso.MoveFile objFolder & "\" & strNewestFolder, objFolder & "\" & "CE_" & Value2 & "_" & Value1 & "_PROD_ATTACHMENTS"
As you can imagine I am getting a 'Type mismatch error' code: 800A000D
Any help would be greatly appreciated!
Thanks,
egr4wig
Any help would be greatly appreciated, but I am trying to rename a folder using a couple of DB object variables and I'm having a tough go at it. I have tried to convert the objects to strings, but have found out that that doesn't really work.
My object variables are:
Dim Value1: Set Value1 = CreateObject("ADODB.Recordset")
Dim Value2: Set Value2 = CreateObject("ADODB.Recordset")
Set Value1 = connection.Execute("SELECT MAX(RUN_NUMBER)...")
Set Value2 = connection.Execute("SELECT RUN_CLIENTID...")
My object folder is the newest folder in:
Dim objFolder: Set objFolder = objFSO.GetFolder("C:\Program Files\Doc_Finder\Docs")
I find the newest with the following:
For Each objFolder in colFolders
If objFolder.DateCreated > dDate Then
dDate = objFolder.DateCreated
strNewestFolder = objFolder
End If
Next
WScript.Echo strNewestFolder
and finally I'm trying to rename the newest folder with the following statement:
fso.MoveFile objFolder & "\" & strNewestFolder, objFolder & "\" & "CE_" & Value2 & "_" & Value1 & "_PROD_ATTACHMENTS"
As you can imagine I am getting a 'Type mismatch error' code: 800A000D
Any help would be greatly appreciated!
Thanks,
egr4wig