If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Change Text Field Length
How can I change the length of a text field programatically?
TIA, Lou |
#2
|
|||
|
|||
Change Text Field Length
How can I change the length of a text field programatically?
Hi Lou, The Size property is read-only for an existing field so you need to create a new field with the new size, copy the data from the old field to the new field, delete the old field and rename the new field to the old name. You may lose data if the new size is smaller than the old size. Something like this sets the size to 189: Dim db As Database Dim td As TableDef Set db = CurrentDb Set td = db.TableDefs("TableName") With td .Fields.Append .CreateField("tmp", dbText, 189) db.Execute "update TableName set tmp = OldName;", dbFailOnError .Fields.Delete "OldName" .Fields("tmp").Name = "OldName" End With Jay |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ASK Field Behavior | Greg | Mailmerge | 9 | July 2nd, 2004 02:44 PM |
NUMBERING the pages | Bob | New Users | 7 | June 14th, 2004 12:20 AM |
How to update or change a text field | Le Tran | New Users | 2 | May 19th, 2004 07:51 PM |
Converting Field Names to Text | Dawn | General Discussion | 1 | May 16th, 2004 07:57 AM |
Text Box in table woes. :( | JOE | Tables | 10 | May 5th, 2004 01:21 AM |