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

Creating an Access table programatically

Status
Not open for further replies.

DeltaTech

Programmer
Apr 16, 2003
92
MY
Hi

While I know how to create the database and tables through VB.Net, I have not been able to find examples that show how to set the field properties.

For instance, if we want to allow for zero length in a particular field.

Any help would be appreciated.

Happy New Year to all!
 
I assume you just use standard DDL statements submitted via an OLEDBCommand object. However, I wasn't aware you need to specifically allow a zero length for a column. Do you mean allow nulls? The syntax would be like:

CREATE TABLE SomeTable (
Column1 INT NULL,
Column2 VARCHAR(10)
)
 
Hi RiverGuy

Null doesn't seem to affect zero length, which after the table is created and you view it through Access is still set at No.

Or is my SQL statement wrong?

"CREATE TABLE tbl ([Column1] TEXT(255) NULL, [Column2] TEXT(255) NULL, [Column3] TEXT(255)) NULL;"

The NULL at the end seems to create an error. If you remove it, the statement executes but does not set the Allow Zero Length property to Yes.

Thanks for trying though.

Have a happy 2010!
 
I'm not sure then. I just tried to look for some examples, and everything I have run across does not list anything about Allow Zero Length. (such as here: Maybe this cannot be specified through DDL? In that case, I would assume you would need to use the Access libraries in your code. By the way, what does Allow Zero Length actually do? Maybe it's equivalent to something else I haven't thought about.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top