Click to See Complete Forum and Search --> : Setting Field Properties for Access table with ADO.


mytonytiger
August 10th, 2001, 11:03 AM
PLEASE HELP!

I'm having difficulty with setting the properties of fields with ADO for an Access DB. I have created a new table and the appropriate Fields (names and datatypes), but cannot figure out how to set the properties such as: "Required", "Allow Zero Length", "Indexed", etc. that can be set from within access.

How can I dynamically tell what properties are available (different datatypes have different properties) , and then set them accordingly.

ANY help would be much appreciated.

Thanks.

Iouri
August 10th, 2001, 11:38 AM
Dim FlatCat As New ADOX.Catalog

FlatCat.ActiveConnection = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\data\mydb.mdb;" 'must use OLEDB.4.0.. not 3.51

Set objNewColumn = New ADOX.Column
objNewColumn.Name = "Additional Information"
objNewColumn.Attributes = adColFixed And Not adColNullable
objNewColumn.Type = adVarWChar
objNewColumn.DefinedSize = 30
objNewTable.Columns.Append objNewColumn
objNewColumn.Properties("Jet OLEDB:Allow Zero Length").Value = True
objNewColumn.Properties("Default").Value = """"""


Iouri Boutchkine
iouri@hotsheet.com

mytonytiger
August 10th, 2001, 01:22 PM
Sorry, I've looked at these methods before, but still haven't found out how to set whether the value of a field is "Required".

To see the properties I want to set, Open a table in Access in Design mode. Down at the bottom is a list of properties. So far, it seems they can't be changed with VB and ADO.

PLEASE, someone tell me how to access these properties.

Thanks again,
Tony