Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ALTER TABLE TO SET DEFAULT

Status
Not open for further replies.

sebpas

IS-IT--Management
Mar 30, 2001
39
CA
I'm trying to create a new column in an access 2000 database via ADO and it works fine but when I just can't seem to find the right syntax to set the default value to 0.
I've looked evrywhere and tried lots of syntaxes but they all give me a syntax error in alter statement. Could somebody tell me the exact syntax with real table name in an example so that I can finally set the default value?

Either you can set it thru the first alter statement (the one that ceates the column) or you have to execute a second qry to specify this criteria.

If you also know a way to set the allow zero length value to yes, I would gladly mak use of it.

Any help will be VERY appreciated.
 
hi!
Actually what you are trying to accomplish is fairly easy. You need to look at tabledef for the details. I createrd a dummy table in the northwind data base with your requirements and was easily able to do so.

You could probably do the same things with SQL statement. Just build your string and then execute it.

Use the WITH END WITH construct to gewt to all the values you need to set for your fields.

A good reference source that I use is "Access 2000 VBA Handbook" from Sybex.

hope this helps.
 
Could you elaborate more by telling me the steps you took to create your dummy table via code and an example that uses the WITH END WITH syntax? How do you work with tabledef?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top