how to control "allow zero-length" property with alter statements

E

EugeneLeung

suppose:

Table A
Column A_a (primary Key)
Column A_b (Char(50); Allow Zero-length : False;)


how can i change it to allow zero-length string with alter statements

Alter Table [A] Alter Column [A_b] char(50) .......

thanks.
 
A

Allen Browne

I don't think you can set the Allow Zero Length property via a DDL query
statement.

You can set it through DAO, through:
dbEngine(0)(0).TableDefs("MyTable").Fields("MyField").AllowZeroLength

Or using ADOX you can set Properties("Jet OLEDB:Allow Zero Length") of the
Column of the Table in the Catalog.

It is unfortunate that different versions of Access are inconsitent in how
these properties are set by default, depending on whether you create the
field through the interface, DDL, DAO, or ADOX.

In general DAO is still the most powerful and suitable library for setting
properties of JET tables. For example it is the only way to set the
DisplayControl of a Yes/No field to check box.
 
E

EugeneLeung

thanks.

you means that i must change my way to do this operation?!
that's pity...

but thank you very much all the same.

Allen Browne said:
I don't think you can set the Allow Zero Length property via a DDL query
statement.

You can set it through DAO, through:
dbEngine(0)(0).TableDefs("MyTable").Fields("MyField").AllowZeroLength

Or using ADOX you can set Properties("Jet OLEDB:Allow Zero Length") of the
Column of the Table in the Catalog.

It is unfortunate that different versions of Access are inconsitent in how
these properties are set by default, depending on whether you create the
field through the interface, DDL, DAO, or ADOX.

In general DAO is still the most powerful and suitable library for setting
properties of JET tables. For example it is the only way to set the
DisplayControl of a Yes/No field to check box.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

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

EugeneLeung said:
suppose:

Table A
Column A_a (primary Key)
Column A_b (Char(50); Allow Zero-length : False;)


how can i change it to allow zero-length string with alter statements

Alter Table [A] Alter Column [A_b] char(50) .......

thanks
 

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