[AccessD] Set a field data type via code

Reuben Cummings reuben at gfconsultants.com
Wed Oct 22 09:11:59 CDT 2003


True, Bryan.  Thanks for pointing that out.

Reuben Cummings
GFC, LLC
phone: 812.523.1017
email: reuben at gfconsultants.com

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Bryan
> Carbonnell
> Sent: Tuesday, October 21, 2003 7:19 PM
> To: Access Developers discussion and problem solving
> Subject: RE: [AccessD] Set a field data type via code
> 
> 
> 
> > > -----Original Message-----
> 
> > > > Is it possible to use code (cbf) to change a field's data type, in
> > > > the
> > > table itself, from number to text?
> 
> On 21 Oct 2003 at 16:26, Reuben Cummings wrote:
> 
> > Based on our work on the Back End Upgrader, in order to change a 
> data
> > type thru code you will need to create a new field, move the data 
> to
> > the new field, delete the original field, and rename the new field.
> 
> 
> Um, you aren't going to believe this Reuben but:
> 
> In A2K, with DAO referenced you can use ALTER TABLE to do it:
> 
> Dim strSQL As String
> Dim db As DAO.Database
> 
> Set db = CurrentDb()
> strSQL = "ALTER TABLE Table1 ALTER COLUMN fldText CHAR(10);"
> 
> db.Execute (strSQL)
> 
> Set db = Nothing
> 
> Where CHAR(10) indicated that it is being changed to a text field 
> with a length of 10 characters.
> 
> In my test fldText started out as a Long Integer field.
> 
> --
> Bryan Carbonnell - carbonnb at sympatico.ca
> Never let a computer see you hurry.
> 
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list