General discussion

Locked

MS ACCESS Table update

By ashishab ·
How do I add new fields to existing access table. I would like to varify the field, If it does not exixst add the field,

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by john.a.wills In reply to MS ACCESS Table update

Open the table in design mode. Write in the new columns as rows in the design. Close the table - or switch to data mode and see the new, empty columns. You can also use this procedure to alter types, but be warned that you may lose data this way.

Collapse -

by Wayne M. In reply to MS ACCESS Table update

I am assuming you want to do this programmatically in VBA.

To verify if the column exists, use a COUNT(columnName) FROM tableName and catch the error. If the column does not exist, the script will throw an error; catch the error and set a flag one way. Otherwise, the routine will run normally. This is a slow and inefficient approach, so if someone knows a better way, please suggest it!

To add a column, use ALTER TABLE - ADD COLUMN. One online reference is http://www.w3schools.com/sql/sql_alter.asp Google for some more. There are also lots of SQL books out there, but the MS Access Jet database only supports a limited subset of standard SQL.

I do not know your familiarity with ADO or DAO programming, but if this is not your comfortable approach, you may want to use the visual tools described in the previous answer.

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums