dim MyDb as database
set mydb = currentdb
dim MyTdf as tabledef
set mytdf = mydb.tabledefs("TableName"
mytdf.fields("FieldName".Name = "NewName"
set mytdf = nothing
set mydb = nothing
What if I don't know the name of the field, but know that it is a first field in the table. Is there such as way to loop through all the fields, find out how many of them and rename them accordingly.
That's a bit more involved. At this point, you are best served by reading the Access Help on the Fields Collection.
The examples are quite good, and the help will give you the details you need to create the field exactly as you need it (there are numerous field properties that you must set correctly).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.