Help

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top