Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009

    Unanswered: how to rename table name in msaccess using odbc and c++

    hi i am using odbc and c++ and i want to rename the table in access.
    then what to do while retriving the tables so a can choose one and rename it.
    or is there any procedure supports by access to rename the table.
    thanks in advance.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    I'm not by far a specialist of C++. An Access database object has a TableDefs collection containing TableDef objects. Each TableDef object has a Name property: that's the name of the table in Access.

    You can retrieve the tables of an Access database by enumerating its TableDefs collection and rename a table by changing the Name property of a TableDef object.

    Warning: Do not try to manipulate TableDef objects with a name beginning in "MSys": those are system tables and must only be used by Access itself.

    See for instance:
    DAO Tabledef: Using Tabledefs (MFC)
    Have a nice day!

  3. #3
    Join Date
    Dec 2004
    Madison, WI
    I would wonder "WHY" you'd want to

    1. rename the table in code in the first place.
    2. go through all the trouble finding a way in code to rename the table when it's easier to just rename the table.
    3. Question the database structure if you need to find ways to rename tables in code (it's just not good practice to rename tables in code.)
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts