Change Data Type using a Macro

  • Follow


How do I change a table data type using a macro?  Specifically I want to 
change a data type from text to numeric.
0
Reply Utf 4/5/2007 2:18:00 PM

Using a macro? not sure that you can.
Using VBA? You can do the following:
    - Rename the "Old" field
    - Add a New field of the new type to the desired table
    - Copy data from Old field to New field
    - Delete old field

That's what Access does under the hood when you change a field's data type, 
*if* there is available disk space. Since it all this is under the hood the 
user may be under the impression you can simply "change" a field's data 
type, when you really can't; you gotta create a new field & copy data to it.

Compact when done to reclaim the file space claimed by the deleted field.

HTH,

"DV" <DV@discussions.microsoft.com> wrote in message 
news:7F5597E8-1241-4102-8361-5E1567C19730@microsoft.com...
> How do I change a table data type using a macro?  Specifically I want to
> change a data type from text to numeric. 


0
Reply George 4/5/2007 3:18:30 PM


Just the thought of this gives me the willies.  What are you trying to do? 
Although you can use DDL, DAO, and ADO to manipulate structures, most 
changes in an Access application are made by the developer via the GUI. 
Usually structural changes from code are only made when distributing a new 
front end that requires table changes in the back end.  Is that what you are 
trying to automate?

"DV" <DV@discussions.microsoft.com> wrote in message 
news:7F5597E8-1241-4102-8361-5E1567C19730@microsoft.com...
> How do I change a table data type using a macro?  Specifically I want to
> change a data type from text to numeric. 


0
Reply Pat 4/5/2007 3:48:56 PM

2 Replies
710 Views

(page loaded in 0.138 seconds)

Similiar Articles:
















7/27/2012 2:23:05 PM


Reply: