View Full Version : Creating ADOX tables


David Thorpe
04-13-2003, 07:05 AM
Can anybody advise me how to specify field parameters when creating ADOX tables? For instance, ".Columns.Append "ITEM", adWChar 16" generates a 16 character field - but how do I set the "Required" property to Yes, or specify a validation rule?

I have tried to adapt a DAO method, but failed miserably!

Travis
04-14-2003, 01:28 PM
have you tried using the Properties of the Column Object.

Example:

cat.Tables("Customers").Columns("CustomerID").Properties("Primary Key").Value = True

Travis
04-15-2003, 08:12 AM
David,

The following are the ADOX Properties of a field (Column)
Index Name
------- --------
0 Autoincrement
1 Default
2 Description
3 Nullable
4 Fixed Length
5 Seed
6 Increment
7 Jet OLEDB:Column Validation Text
8 Jet OLEDB:Column Validation Rule
9 Jet OLEDB:IISAM Not Last Column
10 Jet OLEDB:AutoGenerate
11 Jet OLEDB:One BLOB per Page
12 Jet OLEDB:Compressed UNICODE Strings
13 Jet OLEDB:Allow Zero Length
14 Jet OLEDB:Hyperlink


When ever you don't know all of the properties you can always create a loop to get them.

Example

'Properties are zero based so you have to remove one from the count or you will get an out of range error.
For x = 0 To .Columns("ID").Properties.Count - 1
Debug.Print x & ": " & .Columns("ID").Properties(x).Name
Next x