Adding Fields - Sanity may have left me!

K

Kahuna

This is pretty ridiculous but here I am again stuck with the most basic of
tasks!!!

I need to add a field to an already existing external database.

Here's my code to do this:

Set tdfCompTableName =
dbComp.TableDefs([TableName])
With tdfCompTableName
.Fields.Append
..CreateField(strFieldNameToAdd, varFieldTypeToAdd)
End With
dbComp.TableDefs.Append tdfCompTableName

What I get:

The code assumes that 'TableName' is a field rather than a table. How do I
refer to the table to open it ready to append fields??? Seems easy when
creating a new TableDef but less so when referring to an already existing
Table.

Help appreciated.
 

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