Hello, I am trying to run the code below to add a field to an existing table below:
Public Sub addColumn()
Dim strField As String
Dim curDatabase As Object
Dim ADHD As Object
Dim fldNew As Object
Set curDatabase = CurrentDb
Set ADHD = curDatabase.TableDefs("ADHD")
strField = "DrugType2"
Set fldNew = ADHD.CreateField(strField)
ADHD.Fields.Append fldNew
End Sub
I get the run-time error INVALID FIELD DATA TYPE on line "ADHD.FIELDS.APPEND FLDNEW"
I got this code on line so could be outdated.
Any help? Thanks.