Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this possible? - changing a data type from a form

Status
Not open for further replies.

EDJO

IS-IT--Management
Jun 13, 2003
9
0
0
US
Here's the challenge:

I have a table with a memo field.

I want to build a unbounded form that has a button such that when I click the button, the memo field in the table is (permanently) changed to a text field.

Does anyone know if this can be done? I guess it boils down to whether or not you can get a 'handle' on a table field data type... I know little about this.

Thanks!
 
Hi you could try this:

Dim strSQL As String
DoCmd.SetWarnings False
strSQL = "ALTER TABLE Table1 ALTER COLUMN MyMemoField TEXT(255);"
DoCmd.SetWarnings True
DoCmd.RunSQL (strSQL)

This will change a Memo field named MyMemoField in a Table called Table1 to a Text field.

Note that if your Memo field has any records longer than 255 characters, you will lose any characters past 255

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top