Using VB 6 and Access 2003
Code
Dim db As Database, tbl As TableDef
Set db = DBEngine.OpenDatabase(App.Path & "\txtdata.mdb")
Set tbl = db.CreateTableDef("Temp")
tbl.Connect = "Text;database=" & App.Path & "/ConvTemp/"
tbl.SourceTableName = strOutput & ".txt"
db.TableDefs.Append tbl
db.Execute "Select Temp.* into table1 from Temp"
db.TableDefs.Delete ("Temp")
db.Close
Set tbl = Nothing
Set db = Nothing
MsgBox "File Converted Successfully", vbInformation
From the above code am converting a text file to mdb Database, The above code is working fine.
Am getting a text file from ConvTemp Folder. In that folder every 2 or 5 or 10 minute text file is creating with different names from the other software.
Every minute I want to update a table automatically, whenever the text file is newly created from the ConvTemp Folder.
For Example
ConvTemp Folder
101.txt
The text file should update in the table1, then 101.txt should delete in the convTemp Folder.
After new file is appearing in ConvTemp Folder
222.txt
This text file also should update in the table1, then 222.txt should delete in the convTemp Folder
So on…,
.txt file is appeared it will update in table1, then delete the txt file.
Updating in the table1, and deleting the text file automatically should do when I run the program.
How to write a code for updating automatically, delete the text file?
Need VB6 Code Help.