473,503 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question in .vbs script to pull export from Access

I have a .vbs script that I'm running from the Windows destkop (intend
to have it run by Windows' task scheduler) to pull an export from MS
Access. Here's the script:

' **************************
dim objAccess
Set objAccess = CreateObject("Access.Application")

ObjAccess.OpenCurrentDatabase("C:\codescratch\db1. mdb")

ObjAccess.DoCmd.TransferText acExportDelim, "Expout Export
Specification","table1", "C:\expout.txt", False, ""

ObjAccess.CloseCurrentDatabase
Set ObjAccess = Nothing

MsgBox "Script has finished running."
' **************************
....in this code, "Expout Export Specification" is an export spec I
defined in Access for this simple, 3-col. test table. Using it to
export from within Access works fine.

I get no errors in this script, but the output file is not updates
when this is run. No write to that file takes place. I am required
to have some kind of file present on the filesystem at, in this case,
C:\expout.txt or the script complains that it can't find the file.
That seems odd to me. But again, the file is not updated.

What am I doing wrong? Thanks!

bp
Nov 12 '05 #1
2 4282
This won't automatically overwrite the existing file, I don't think.
You'd have to put a kill statement in your code before running the
export to delete the existing file first.

something like:

Public Function ExportFile()
On Error Resume Next

Kill ("C:\MyTestExport.txt")
DoCmd.TransferText acExportDelim, "MySpecification", "MyTable",
"C:\Test.txt", True
End Function
Nov 12 '05 #2
In article <bf**************************@posting.google.com >,
pi********@hotmail.com (Pieter Linden) wrote:
This won't automatically overwrite the existing file, I don't think.
You'd have to put a kill statement in your code before running the
export to delete the existing file first.

something like:

Public Function ExportFile()
On Error Resume Next

Kill ("C:\MyTestExport.txt")
DoCmd.TransferText acExportDelim, "MySpecification", "MyTable",
"C:\Test.txt", True
End Function


Hmm...

As I understand, the TransferText method does indeed overwrite the file
if it is present. It is odd to me that it must be present or I receive
a file-not-found error, as well.


bp

--
Heisenberg may have slept here.
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3308
by: Sticks | last post by:
ok... im not quite sure how to describe my problem. i have a php script that runs through my entire php site and writes the resulting output to html files. this is necessary as the nature of the...
2
1751
by: OneSolution | last post by:
Hi All, I found out that I can use the header function to redirect a page. However, it gives me an error like that: Warning: Cannot add header information - headers already sent by (output...
5
1747
by: news | last post by:
I have a new situation I'm facing and could use a suggestion or two, as I don't seem to be able to think in the abstract very well. We have a local server which holds all of our image files. We...
7
2601
by: Gustavo L. Fabro | last post by:
Greetings! Some classes that once compiled without problems on VS 2003 have now problems on VS 2005 Beta 1. I'm talking about a __nogc class that is exported with __declspec(dllexport). The...
14
1441
by: Frank Rizzo | last post by:
I realize that this maybe the wrong forum, but maybe someone has run into this situation before. I sell an app and I want to offer my customers a migration path from a competing product. However,...
9
2398
by: CGW | last post by:
I asked the question yesterday, but know better how to ask it, today: I'm trying to use the File.Copy method to copy a file from a client to server (.Net web app under IIS ). It looks to me that...
4
7351
by: =?Utf-8?B?QnJpYW5ESA==?= | last post by:
Hi Does anyone know of a way (via code behind) to pull a single sheet out of a Excel workbook and convert it to a stand alone html document? Thanks Brian
3
3100
by: bluedogsd | last post by:
I have a new server RHE4 and I am having an issue I have never had before and it's kind of urgent. Running Apache 2.0 I need the web server to have writable access and getting denied - I'm pretty...
7
1729
by: Petra Meier | last post by:
Hello, if I use the following function for all my mySql commands in php, am I protected against all SQLinjections and XSS attacks? function sanitize($value){ return...
0
7084
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7458
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.