We recently updated our
Terms and Conditions for TechRepublic Premium.
By clicking continue, you agree to these updated terms.
Invalid email/username and password combination supplied.
An email has been sent to you with instructions on how to reset your password.
Welcome to TechRepublic!
All fields are required. Username must be unique. Password must be a minimum of 6 characters and have any 3 of the 4 items: a number (0 through 9), a special character (such as !, $, #, %), an uppercase character (A through Z) or a lowercase (a through z) character (no spaces).
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.
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.