473,327 Members | 1,979 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,327 software developers and data experts.

moving txt files after import

9
hi,
I'm using the following function to import files form a specified directory. Admittedly I found it elsewhere and amended it but it does seem to work. Is it possible to take it a step further and move the files to another folder after the import is complete?
Expand|Select|Wrap|Line Numbers
  1.  
  2. Function Import_Records()
  3. 'On Error GoTo Import_Records_Err
  4.  
  5. Dim strInputDir, strImportFile As String, strTableName As String
  6. Dim strFileExt As String
  7. Dim strSQL As String
  8. Dim strSelectFdr As Module
  9.  
  10.  
  11. ' the pathname of the folder that contains the files for import
  12. strInputDir = "S:\batchfile\scan9"
  13.  
  14.  
  15. ' the file extension for the type of files to import
  16. strFileExt = ".txt"
  17.  
  18.  
  19. ' the destination table in the database
  20. strTableName = "scanner input"
  21.  
  22.  
  23. strImportFile = Dir(strInputDir & "\*" & strFileExt)
  24. Set db = CurrentDb
  25.  
  26.  
  27. Do While Len(strImportFile) > 0
  28.    DoCmd.TransferText acImportDelim, "00057_08082007 Import Specification", strTableName, strInputDir & "\" & strImportFile, False
  29.    strImportFile = Dir
  30. Loop
  31.    ' Beep
  32.     MsgBox "The Import has Completed", vbOKOnly
  33.  
Aug 14 '07 #1
2 1705
JKing
1,206 Expert 1GB
If you want to programmatically move a file you can use a combination of the FileCopy and the Kill command to simulate a move. Filecopy would allow you to copy the source file to the new destination and the Kill command would delete the file at it's original source.

Is this what you're looking for?
Aug 14 '07 #2
Neil99
9
thats it in a nutshell. I'll check out the help files on those, but i'll probably be back.

many thanks
Aug 14 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Stephen Ghelerter | last post by:
I am moving a web site with a MySql database to another server. Can I create a database on the new server with the same name and then move the tables there, or is life not that simple? Or can I...
2
by: Jay | last post by:
Hi, After a power outage (and UPS failure), my boss's SQL Server 2000 won't start (or crashes quickly or something). We don't have any backups, as it's a test server. Is there a way to import the...
4
by: erkki | last post by:
Hi, I have to move iSeries library to new DB2 database. Is there any easier way to do this moving operation than exporting all tables in iSeries into text files and then import them into DB2...
3
by: genojoe | last post by:
I have tried everything I can think of to move records from one Access database to another. It should not be that hard. Read on.... I have identical access mdb's. One contains data; one...
3
by: Iavor Raytchev | last post by:
Hello, We a situation with a central database that contains the data that needs to be presented at N off-line terminals (N can be 5 000 can be 15 000). Each terminal presents unique data. The...
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 ...
8
by: John Dann | last post by:
Just getting started with VB2005 and unsure how best to move active VB2003 projects into the VB2005 environment. Nornally I've versioned my VB2003 projects at specific development points by...
3
by: DMina | last post by:
Hello people, I have this requirement to move a DB2 V8 database from Windows 2000 to AIX V5.3. I have managed to do that for a small simple database using export/import and db2look. Now i have...
2
by: fuzzybr80 | last post by:
I am using MySQL 5.0 with a number of innodb tables whose ibdata files are growing quite quickly and filling up the /var partition (file is /var/mysql/ibdata1). Earlier on I followed instructions...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.