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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DEFAULT clause in CREATE TABLE statement

Status
Not open for further replies.

benasumwa

Programmer
Oct 14, 2003
57
KE
Hi all,

How do I create a an access table programatically
though a connection with the DEFAULT clause included?
The clause is available in Design View

This statement fails:

Code:
CREATE TABLE MyTable (MyField1 Numeric NOT NULL DEFAULT 0)

But works with the DEFAULT removed.

I have a round 100 tables to CREATE, but in access
database. My front-end is Visual Foxpro 6.0.
The table definitions are available and the easiest
thing to do is to create them through a connection by sending SQL statements. This method works until
I include DEFAULT stuff.

Any idea?

---------------------------
Benson O. A.
Infinity Link Limited
 
?
CREATE TABLE MyTable (MyField1 Numeric DEFAULT 0 NOT NULL )
 
JetSQL lacks the DEFAULT clause in its DDL implementation.
You may play with the DefaultValue property of the DAO.Field object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 

JerryKlmns

Code:
CREATE TABLE MyTable (MyField1 Numeric DEFAULT 0 NOT NULL )

Refuses to co-operate as well.

PH said:
JetSQL lacks the DEFAULT clause in its DDL implementation.

You've confirmed my suspicion. I'll look for workarounds.

Thanks nonetheless.

---------------------------
Benson O. A.
Infinity Link Limited
 
A2k3
CURRENTPROJECT.Connection.Execute "CREATE TABLE MyTable (MyField1 Numeric DEFAULT 0 NOT NULL, MyField2 Numeric NOT NULL)"

The difference is the existance of default value of 0 on MyField1 and not on MyField2
 
Now I got it!

You were doing this with a qery! "programatically" meant VBA to me! After reading carefully spoted Design View.

And YES PHV is correct ONCE AGAIN!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top