Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird ActiveX problem

Status
Not open for further replies.

jdgonzalez

Programmer
May 11, 2004
72
US
I'm really hoping someone can help me out on this one. It's about to drive me NUTS! I have a DTS package that runs everyday. One of the steps is to copy a file locally and move it to a datashare and then changes the name of the file. Here's the wringer. When you open the file on the datashare it's not correct, but when you open that same file locally it is correct. If I delete the datashare file and just execute the active x script on it's own, it will copy and change the file (like it's supposed to do) and display the correct data.

When I say the data is not correct, I mean that it has an old 'snapshot' that it is copying over.

Code:
Function Main()

Dim FSO
Set FSO=CreateObject("Scripting.FileSystemObject")
On Error Resume Next

FSO.CopyFile  "d:\data\Data\localdata.xls", "\\myserver\"

Main = DTSTaskExecResult_Success
End Function
Next step
Code:
Function Main()


Dim FileDate
Dim DateString
Dim FSO 
Dim File

FileDate = Date
DateString = DatePart("yyyy",FileDate) & Right("0" & DatePart("m",FileDate), 2) & _
	Right("0" & DatePart("d",FileDate), 2)

Set FSO =  CreateObject("Scripting.FileSystemObject")
Set File = FSO.GetFile("\\myserver\mydata.xls")
File.Name = "mystring& DateString & ".xls"

Main = DTSTaskExecResult_Success
End Function

Any help the community can provide would be greatly appreciated.
 
Are these literally represented? How does the second step know that "mydata.xls" is actually "localdata.xls"?

Phil Hegedusich
Senior Web Developer
IIMAK
-----------
Boy howdy, my Liberal Studies degree really prepared me for this....
-----------
A skeleton walks into a bar, and says "I'll have a beer and a mop.
 
Phil,

In production they both have the same file name. I just changed them for this example.

 
Otay.

Set your objects to Nothing when you're done with them. You may be holding on to an old instance. There's also some write latency in the file system; ugly and arcane, but true. I've never experienced it using FSO, but hey, you never know....

Phil Hegedusich
Senior Web Developer
IIMAK
-----------
Boy howdy, my Liberal Studies degree really prepared me for this....
-----------
A skeleton walks into a bar, and says "I'll have a beer and a mop.
 
Phil, I tried you suggestion still no luck.

Maybe there is something wrong in my process. Does anyone have a better way of exporting data. My requirement is that it have to be in Excel.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top