How do I change the field name of a table?

Source: Internet
Author: User
Problem:
How do I change the field name of a table?
Jet SQL can change the field type, could you change the name of the field with Jet SQL?

Reply:

Jet SQL cannot change field names unless you use several Jet SQL to delete the field and then insert the word
section, and then use the update query to restore the original field data for the saved temporary table.
Alternatively, you can change the Name property of the TABLE's Columns (field name) object directly with ADOX.
Function Test ()
Changetablefieldname_ado "Table 1", "AA", "Pic1"
End Function
Function Changetablefieldname_ado (Mytablename As String, Myfieldname as String, strNewName as String)
' 3 parameters:
' Mytablename string, table name
' Myfieldname string, original field name
' strNewName string, new field name
' Remember to quote ADOX first
Dim MyDB as New ADOX. Catalog
Dim MyTable as ADOX. Table
Mydb.activeconnection = CurrentProject.Connection
Set MyTable = mydb.tables (mytablename)
Mytable.columns (Myfieldname). Name = strNewName
End Function


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.