[AccessD] Change Field Type

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Mon Sep 22 14:56:38 CDT 2008


Hi Rocky,

I'd think you have to:

- 1) create a new column with required data type;
- 2) set values of this new column using update SQL clause;
- 3) delete old column;
- 4) rename new column to the old column name;
- 5) change ordinal position for the renamed column (can be done in step (4)
- 6) set indexes for the new column if needed...
- 7) (re-)define relationships;

I can be wrong but I suppose that changing column type in code directly in
one step isn't possible...

As we all know it's possible to change column type in one direct step in
design mode but I'd suppose that "under the hood" the above sequence of
actions is performed...

Thank you.

--
Shamil

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Monday, September 22, 2008 11:27 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Change Field Type

Dear List:
 
I am trying to change the type of a field 'StartBase' in table
'MatterActions' from Number to Boolean.  I've tried two approaches:
 
1) dbs.Execute "ALTER TABLE [MatterActions] ALTER Column StartBase Boolean"
givers the error 3381 There is no field named 'Boolean' in table
'MatterActions'

2) Set tdf = dbs.TableDefs("MatterActions")
tdf.Fields("StartBase").Type = dbBoolean
 
gives the error invalid operation on the second line.
 
Does anyone know the correct code to change this field's type?

MTIA
 
Rocky
 

 	
	

-- 
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