473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Moving a file to an archive directory after import

RJS
I am currently working on the following piece of code for MS Access which
searches for a particular file name and then uses the Access Transfer Text
command to load to a table in my Access DB. I'm not a programmer so I'm just
winging this and what I'd really like to do is be able to move files that
are already processed to another directory so they can't be loaded again.
Any help that people can provide is greatly appreciated.

Private Sub Command0_Click()
Dim fs
Dim i As Integer
Dim sArchiveDir As String
sArchiveDir = "C:\scg\American Powernet\target\done"
Set fs = Application.FileSearch
With fs
.Lookin = "C:\temp\data\target"
.FileName = "INVOICE_*.CSV"
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count

DoCmd.TransferText acImportDelim, "Bill Invoice", "Bill Invoice",
..FoundFiles(i), False, ""

Next i
Else
MsgBox "There were no files found."
End If
End With

End Sub
Nov 12 '05 #1
1 4539
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

After the TransferText command, use the FileCopy and Kill commands.
See the Access VBA help files for their usage.

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP7luC4echKqOuFEgEQKRjgCfStF6zYtML1r637eRBILkm1 QftCoAoK24
Q1YKaCpa9jZRGKtLoZafBKyp
=HzdR
-----END PGP SIGNATURE-----

RJS wrote:
I am currently working on the following piece of code for MS Access which
searches for a particular file name and then uses the Access Transfer Text
command to load to a table in my Access DB. I'm not a programmer so I'm just
winging this and what I'd really like to do is be able to move files that
are already processed to another directory so they can't be loaded again.
Any help that people can provide is greatly appreciated.

Private Sub Command0_Click()
Dim fs
Dim i As Integer
Dim sArchiveDir As String
sArchiveDir = "C:\scg\American Powernet\target\done"
Set fs = Application.FileSearch
With fs
.Lookin = "C:\temp\data\target"
.FileName = "INVOICE_*.CSV"
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count

DoCmd.TransferText acImportDelim, "Bill Invoice", "Bill Invoice",
.FoundFiles(i), False, ""

Next i
Else
MsgBox "There were no files found."
End If
End With

End Sub

Nov 12 '05 #2

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

Similar topics

1
by: Gema Gema | last post by:
I have a large collection of directories full of various files and am looking to create custom text files for the contents of each directory. Here is the situation: The directories are named...
1
by: Tor Rest | last post by:
This is the scenario: I have the following ZIP files in a directory. The numbers represent versions (the highest number is the latest version of the file). mercury001.zip mercury002.zip...
4
by: ED | last post by:
I currently have 2 oracle databases that my access database is going to gather data from. The IT department wants to give me data snaps in the form of a flat file. They will FTP the flat file to...
2
by: 63q2o4i02 | last post by:
Hi, I'm using python 2.4 and windows XP. I have two packages in the windows version of python in site-packages. They are PyVisa and ctypes, and both live in c:\python24\lib\site-packages ...
1
by: Peter Thorne | last post by:
I am a perl newbie who is trying to write a script to automate a task. I have a large collection of compressed archives (mostly .tar.gz, tar.bz2, tar.Z, .tgz etc). This are stored in a number...
12
by: pac | last post by:
I'm preparing to distribute a Windows XP Python program and some ancillary files, and I wanted to put everything in a .ZIP archive. It proved to be inordinately difficult and I thought I would...
3
by: acatejr | last post by:
I know how to "walk" a folder/directory using Python, but I'd like to check the archive bit for each file. Can anyone make suggestions on how I might do this? Thanks.
4
by: Sutharsan Nagasun | last post by:
Hi, I am new to Perl. I need help with file search for the following scenario. Currently as part of the archiving process, we have archived the files under /$rootdir/Archive/yyyy directory where...
5
by: swethak | last post by:
hi, i want to zip the folder using php. Any body plz help for that.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.