If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Alter tables via code
HI there,
I need to be able to add a new field to my table and change the data types of certain fields by using code. Any Ideas? |
#2
|
|||
|
|||
Alter tables via code
These examples show how to use a DDL query statement to:
- change the size of a field; - change the data type of a field; - add a new field to a table; - remove a field from a table: ALTER TABLE MyTable ALTER COLUMN MyText2Change TEXT(100); ALTER TABLE MyTable ALTER COLUMN MyField DOUBLE; ALTER TABLE MyTable ADD COLUMN SomeNewField TEXT(60); ALTER TABLE MyTable DROP COLUMN SomeNewField; You can execute a string using DAO dbEngine(0)(0).Execute strSQL or ADO: CurrentProject.Connection.Execute strSql -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Bob" wrote in message ... HI there, I need to be able to add a new field to my table and change the data types of certain fields by using code. Any Ideas? |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Removing a form and all of the module code for it | Jack Gillis | General Discussion | 4 | July 25th, 2004 07:07 PM |
VBA Code Help - Badly needed | venus as a boy | General Discussion | 1 | July 20th, 2004 06:53 PM |
Hi! Urgent pls: Protecting sheets so macros/buttons still work? | StargateFanFromWork | General Discussion | 7 | July 3rd, 2004 02:25 PM |
searching for "join tables" and "join word tables" | Uncle Bill | Tables | 1 | June 11th, 2004 09:33 PM |
Multiple Many-To-Many Tables | Tom | Database Design | 7 | May 15th, 2004 03:47 AM |