File Export Dpecification deletes file (1 Viewer)

bauer

Registered User.
Local time
Today, 02:16
Joined
Aug 23, 2001
Messages
77
:confused:
Hi there.

I have something strange going on. I have a file export sceification that I have set up, and I run Docmd.TransferText with a spcification that I set up. When it runs right as that line is hit, the file that I am intending on exporting to deletes. I can't explain it. I am really confused.

I tried changing the directory the file was in, changing the file name, and it just kept deleting.

I really need some help on this.

Thanks for your help in advance
 

fuzzygeek

Energy Ebbing
Local time
Today, 07:16
Joined
Mar 28, 2003
Messages
989
MoInfo

Please post your code so we can perhaps help.
 

bauer

Registered User.
Local time
Today, 02:16
Joined
Aug 23, 2001
Messages
77
I don't have the code in front of me, but this is pretty much the function where the file disppears from
Code:
[COLOR=blue]Dim[/COLOR]  fs [COLOR=blue]As[/COLOR]  fileScriptingObject
[COLOR=blue]Set[/COLOR]  fs = CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile("temp.txt")

[COLOR=green]'where qryName is my query that I am exporting from
'and "fileExportSpec" is the file spec that I set up using
'the Import Text Wizard from Access, and then going to
'the Advanced.. button, and saving it[/COLOR] 
DoCmd.TransferText acExportDelim, "fileExportSpec", qryName, "temp.txt", [COLOR=blue]False[/COLOR]

That is really all that that function does. And, as soon as it hits the line for the DoCma.TransferText, the file deletes. I have even watched it disappear from explorer as I stepped through that line.

Thank you for your help
 
Last edited:

fuzzygeek

Energy Ebbing
Local time
Today, 07:16
Joined
Mar 28, 2003
Messages
989
File is deleted and replaced as designed

The following is from the help file for the transfertext action:

"Access creates a new text file when you export data from Access. If the file name is the same as the name of an existing text file, Access replaces the existing text file."

So according to the TransferText Action help file, the original file that you are creating is deleted and replaced with the one designated in your TransferText code.
 

bauer

Registered User.
Local time
Today, 02:16
Joined
Aug 23, 2001
Messages
77
That would be fine, however, when it gets to that line, it deletes the file, and then give me an error that it can't find the file temp.txt.

I mean I'm not sure why I have to create the file first then. However, even when I got rid of the line to create the file, I still got that error. It seems as if it just won't re/create the file.

Thanks
 

fuzzygeek

Energy Ebbing
Local time
Today, 07:16
Joined
Mar 28, 2003
Messages
989
May not be answer

I had a customer who couldn't use any of my databases without errors. Eventually I had her check all her dll's and found that all her ado*.dll's were corrupt. Try two things:
(1) Check your references to see if any are missing.
(2) Run the MS component checker to see if any of your data link libraries are corrupted. You can download the CC (free) from the MS site at the following link.

Download MS Component Checker

What you are describing should not be happening.
 

bauer

Registered User.
Local time
Today, 02:16
Joined
Aug 23, 2001
Messages
77
Thanks,

You're right, this shouldn't be happening. The references are all correct, however I don't know about the dll's.

But here is another kicker I forgot. You see this used to work for my client. The only thing was he was having problems with wrokgroups, so we imported everything into a new database. Now everything transfered over fine excpet for the the file specifications that I made. So I recreated them, and that is when the problem started.

I can't imagine that there is something in the file spec that I made that would do this, as I didn't think it can do that.

Anyway, thanks for your help. If all else fails, I'll just have to try it again and see if this still happens.
 

bauer

Registered User.
Local time
Today, 02:16
Joined
Aug 23, 2001
Messages
77
Thanks Fuzzy,

I'm going to try that.
 

Users who are viewing this thread

Top Bottom