I am attempting to create an access table containing the index information for around 548,000 images. Currently, the index information is contained in around 525 .txt files. I have found that I can accurately import this information into access via external data -> import new data. The .txt files are uniformly formatted with column names in the first row, and the respective attributes delimited by "|". I suppose what I'm asking for, is help creating a macro that will iterate through this folder, and import each of these .txt files into a single table that I can then use to search for the corresponding image. Here's a VBA I used to previously iterate through a folder of .dbf files. How might I use this to iterate through .txt files delimited by "|"
Option Compare Database
Private Sub ImportDBF()
On Error GoTo ErrHandler 'change to On Error GoTo ErrHandler if you want to see errors.
Dim oFSystem As Object
Dim oFolder As Object
Dim oFile As Object
Dim sFolderPath As String
Dim i As Integer
sFolderPath = "C:\Users\Juan Rodriguez\Desktop\Well data headers"
Set oFSystem = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSystem.getfolder(sFolderPath)
For Each oFile In oFolder.Files
If Right(oFile.Name, 3) = "dbf" Then
SQL = "INSERT INTO complete_db SELECT * FROM [" & oFile.Name & "]" _
& " IN '" & sFolderPath & "'[dBASE IV;]"
CurrentDb.Execute SQL
End If
Next oFile
Exit Sub
ErrHandler:
MsgBox Err.Description
End Sub
I have attached some images containing the filepath for the .txt files as well as the filepath for the images. The images are in various subdirectories.image1image2
Any insight is greatly appreciated! Thank you in advance!