Q: programmatically add/modify fields?

M

MarkD

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?
 
A

Allen Browne

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).
 
M

MarkD

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.

Reply to group, rather than allenbrowne at mvps dot org.




.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top