Imported text file into Access table and field names did not import correctly. (Field names are in row 30!)
Currently, field names are field1, field2, field3, etc.
I assume that I can modify the code below to not only change the field names but also to specify the data type in the field. Is this correct?
Also, during the import of the text file, I was not prompted with the dialog on whether to specify the first row as column field name. Any known reasons why I was not prompted?
Public Sub ChangeFieldName(TableName As String, OldName As String, NewName As String)
Dim db As DAO.Database, tdf As DAO.TableDef
Set db = CurrentDb
Set tdf = db.TableDefs(TableName)
tdf(field1).Name = CustomerName
tdf(field2).Name = CustomerAddress
tdf(field3).Name = CustomerPhone
Set tdf = Nothing
Set db = Nothing
End Sub
Currently, field names are field1, field2, field3, etc.
I assume that I can modify the code below to not only change the field names but also to specify the data type in the field. Is this correct?
Also, during the import of the text file, I was not prompted with the dialog on whether to specify the first row as column field name. Any known reasons why I was not prompted?
Public Sub ChangeFieldName(TableName As String, OldName As String, NewName As String)
Dim db As DAO.Database, tdf As DAO.TableDef
Set db = CurrentDb
Set tdf = db.TableDefs(TableName)
tdf(field1).Name = CustomerName
tdf(field2).Name = CustomerAddress
tdf(field3).Name = CustomerPhone
Set tdf = Nothing
Set db = Nothing
End Sub