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
|
|||
|
|||
Q: programmatically add/modify fields?
Using Access 2000.
I want to programmatically add a field to a table and modify another field. Can I write an ALTER TABLE statement, or do I have to change it via tabledef? Also, one of the fields we change from text to numeric, which invalidates some data (which is okay). Right now, I open the table in design mode, change the field, save the table. Access warns of the error and I just accept it. Will I be able to change the field in SQL (or via tabledef), or will these invalid values cause Access to not allow me to do that? |
#2
|
|||
|
|||
You can execute a DDL query statement
dbEngine(0)(0).Execute "ALTER TABLE ...", dbFailOnError From memory that just loses any data that no longer fits (e.g. non-numeric data if you ALTER COLUMN to a number). -- 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. "MarkD" wrote in message ... Using Access 2000. I want to programmatically add a field to a table and modify another field. Can I write an ALTER TABLE statement, or do I have to change it via tabledef? Also, one of the fields we change from text to numeric, which invalidates some data (which is okay). Right now, I open the table in design mode, change the field, save the table. Access warns of the error and I just accept it. Will I be able to change the field in SQL (or via tabledef), or will these invalid values cause Access to not allow me to do that? |
#3
|
|||
|
|||
Cool! Thanks much.
-Mark -----Original Message----- You can execute a DDL query statement dbEngine(0)(0).Execute "ALTER TABLE ...", dbFailOnError From memory that just loses any data that no longer fits (e.g. non-numeric data if you ALTER COLUMN to a number). -- 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. "MarkD" wrote in message ... Using Access 2000. I want to programmatically add a field to a table and modify another field. Can I write an ALTER TABLE statement, or do I have to change it via tabledef? Also, one of the fields we change from text to numeric, which invalidates some data (which is okay). Right now, I open the table in design mode, change the field, save the table. Access warns of the error and I just accept it. Will I be able to change the field in SQL (or via tabledef), or will these invalid values cause Access to not allow me to do that? . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook contacts doesn't allow all fields from Excel? | gnmcewen | Contacts | 0 | January 9th, 2005 04:21 AM |
Additional fields for form based parameter query/null fields | geeksdoitbetter | Running & Setting Up Queries | 2 | January 7th, 2005 10:05 PM |
Populate fields in Form Header based on header fields in startup f | Pat Dools | Using Forms | 0 | January 7th, 2005 03:19 PM |
Automatic filling of fields in table two from table one | Jim Kelly | Database Design | 1 | September 27th, 2004 10:16 PM |
How to Delete Custom Fields Programmatically in Contact | Ajay | Contacts | 1 | June 28th, 2004 04:56 PM |