[AccessD] Change Field Type

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Mon Sep 22 15:07:53 CDT 2008


Poop. I guess I'll have to use Shamil's approach.

Thanks. 


Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com
www.bchacc.com
 
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Monday, September 22, 2008 12:58 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Change Field Type

If this is an Access DB then you cannot alter a column this way. According
to the OLH these are the only data definitions statements supported:

CREATE TABLE Creates a table
ALTER TABLE Adds a new field or constraint to an existing table DROP Deletes
a table from a database or removes an index from a field or group of fields
CREATE INDEX Creates an index for a field or group of fields 

So to do what you want you would need to add the Boolean column. Run an
update query to fill the new Boolean column with Cbool(MatterActions), and
the drop the MatterActions column.

Lambert

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