P
praetorianprefect
Adding a column to the current table is not working. Importing files
and using filenames as tables work.
Function GetData()
' Declare variables
Dim InputDir, ImportFile As String, tblName As String, strsql As String
InputDir = ("c:\")
ImportFile = Dir("c:" & "\*.txt")
On Error Resume Next
Do While Len(ImportFile)
tblName = Left(ImportFile, (InStr(1, ImportFile, ".") - 1))
& "log"
DoCmd.TransferText acImportDelim, , tblName, ImportFile, 0
CurrentDb.Execute "ALTER TABLE" & tblName & "ADD COLUMN
gDatafile TEXT;"
CurrentDb.Execute "UPDATE " & tblName & " SET gDatafile = '"
& ImportFile & "'" & _
"WHERE gDatafile Is Null;"
ImportFile = Dir
Loop
End Function
and using filenames as tables work.
Function GetData()
' Declare variables
Dim InputDir, ImportFile As String, tblName As String, strsql As String
InputDir = ("c:\")
ImportFile = Dir("c:" & "\*.txt")
On Error Resume Next
Do While Len(ImportFile)
tblName = Left(ImportFile, (InStr(1, ImportFile, ".") - 1))
& "log"
DoCmd.TransferText acImportDelim, , tblName, ImportFile, 0
CurrentDb.Execute "ALTER TABLE" & tblName & "ADD COLUMN
gDatafile TEXT;"
CurrentDb.Execute "UPDATE " & tblName & " SET gDatafile = '"
& ImportFile & "'" & _
"WHERE gDatafile Is Null;"
ImportFile = Dir
Loop
End Function