[AccessD] Renaming a field through code

Jurgen Welz jwelz at hotmail.com
Fri Jul 18 12:32:03 CDT 2008


You can't change it in a linked table, but you can open the database and change a field name with DAO.  I just ran the bit of code below and it renamed the field in the source database.

Dim db As DAO.Database
Dim tbl As DAO.TableDef
Dim fld As DAO.Field

Set db = OpenDatabase("S:\GOM\OmDataBackUp 080621.mdb")
Set tbl = db.TableDefs("tblCompany")
Set fld = tbl.Fields(3)
fld.Name = "HorseManure"

Is there any reason you can't just use an alias?  Changing field names on the fly in a multi user environment could cause some problems.

Ciao
Jürgen Welz
Edmonton, Alberta
jwelz at hotmail.com

> From: rockysmolin at bchacc.com
> To: accessd at databaseadvisors.com
> Date: Fri, 18 Jul 2008 09:56:09 -0700
> Subject: [AccessD] Renaming a field through code
>
> Dear List:
>
> Is is possible to rename a field in a linked table through code?
>
> MTIA
>
>
>
>
>
> Rocky Smolin
>
> Beach Access Software
>
> 858-259-4334
>
> www.e-z-mrp.com 
>
> www.bchacc.com 
>
>
>
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

_________________________________________________________________
Try Chicktionary, a game that tests how many words you can form from the letters given. Find this and more puzzles at Live Search Games!
http://g.msn.ca/ca55/207



More information about the AccessD mailing list