Field properties

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to change the properties of a field in a table
programmatically? For instance, I want to update the "Instruction" field in
the "Data" table by changing the size from 50 to 250.

I have a macro that will cycle through a number of folders and I want to add
some code to change the field size for a database in each folder.

Any help getting started would be appreciated. Thanks for the help.
 
Hi,
most of the field properties you can change, but not size. For size you have
to create a new field with required size (there is a sample in online help),
copy data from old field to new using update query, delete old field and
then rename new to old name

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 
You can use DDL (SQL) to change field size.

-- Code snippet --
Dim dbAny as DAO.Database
Dim strSQL as String
strSQL = "ALTER TABLE Data ALTER COLUMN Instruction TEXT(250) "
Set Dbany = CurrentDb()
DbAny.Execute strSQL, dbFailonError


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top