I don't have experience working in the older DAO methods,
but the newer ADO methods might use an approach to
changing field names in a table like this:
Public Sub TableFieldNameModify(strOld as String, strNew
as String, strTbl as String)
Dim cat As New ADOX.Catalog
Dim cnn As New ADODB.Connection
Dim tbl As New ADOX.Table
Set cnn = CurrentProject.Connection
Let cat.ActiveConnection = cnn
Set tbl = cat.Tables(strTbl)
Let tbl.Columns(strOld).Name = strNew
End Sub
WHERE:
strOld is the current field name to be changed
strNew is the desired field name
strTbl is the name of the table containing the field
You've gotten a couple of answers on how to do this now. I just wanted to
remind you that if you change the field names, that doesn't change the names
in any objects linked to that table (i.e.: queries, forms, reports, etc.).
Assuming you're using DAO, double check to make sure you're
using the exact spelling of the table and field names.
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.