Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Field properties

0 views
Skip to first unread message

JT

unread,
Nov 15, 2007, 8:31:01 AM11/15/07
to
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.
--
JT

Alex Dybenko

unread,
Nov 15, 2007, 8:35:37 AM11/15/07
to
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

"JT" <J...@discussions.microsoft.com> wrote in message
news:00423B3B-AAD7-4E7F...@microsoft.com...

John Spencer

unread,
Nov 15, 2007, 8:57:30 AM11/15/07
to
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
.

"Alex Dybenko" <ale...@PLEASE.cemi.NO.rssi.SPAM.ru> wrote in message
news:epgnmx4J...@TK2MSFTNGP05.phx.gbl...

Alex Dybenko

unread,
Nov 15, 2007, 11:03:23 AM11/15/07
to
Thanks for update John!

Never tried to do so via DDL, will try!

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

"John Spencer" <spe...@chpdm.edu> wrote in message
news:ebEje94J...@TK2MSFTNGP05.phx.gbl...

0 new messages