If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Change Field.required property in ADOX
How am I change the "required" property in the field column in ADOX. It is
default value as "Yes". I wanna change it to "No" when I create a new table & field in ADOX statement. thanks dom |
#2
|
|||
|
|||
I'm trying to do the same thing. Can't figure out the syntax
Dim oTbl As ADOX.Table Set oTbl = New ADOX.Table 'Add field oTbl.Columns.Append "lngTestValue", adInteger ' this works, but now I want to set the "Nullable" property to true. 'I tried a bunch of things, but can't find the right syntax. "Brendan Reynolds" wrote: There is no "Required" property in ADOX. In ADOX, set the Nullable property to False to require entry in a field, or True to allow records with no entry in the field. -- Brendan Reynolds (MVP) dom wrote in message ... How am I change the "required" property in the field column in ADOX. It is default value as "Yes". I wanna change it to "No" when I create a new table & field in ADOX statement. thanks dom |
#3
|
|||
|
|||
Now I remember why I dislike ADOX so much! :-( On testing, I can't get my original suggestion to work either. But the following seems to work. After running this code, when I look at the table in design view, the first field ("ANonNullableColumn") has the Required property set, the second field ("ANullableColumn") doesn't. Public Sub TestNullable() Dim cat As ADOX.Catalog Dim tbl As ADOX.Table Dim col1 As ADOX.Column Dim col2 As ADOX.Column Set cat = New ADOX.Catalog cat.ActiveConnection = CurrentProject.Connection Set tbl = cat.Tables("tblTest") Set col1 = New ADOX.Column With col1 .Name = "ANonNullableColumn" .Type = adInteger End With tbl.Columns.Append col1 Set col2 = New ADOX.Column With col2 .Name = "ANullableColumn" .Type = adInteger .Attributes = adColNullable '------------------------------------NB End With tbl.Columns.Append col2 End Sub -- Brendan Reynolds (MVP) "John S" wrote in message ... I'm trying to do the same thing. Can't figure out the syntax Dim oTbl As ADOX.Table Set oTbl = New ADOX.Table 'Add field oTbl.Columns.Append "lngTestValue", adInteger ' this works, but now I want to set the "Nullable" property to true. 'I tried a bunch of things, but can't find the right syntax. "Brendan Reynolds" wrote: There is no "Required" property in ADOX. In ADOX, set the Nullable property to False to require entry in a field, or True to allow records with no entry in the field. -- Brendan Reynolds (MVP) dom wrote in message ... How am I change the "required" property in the field column in ADOX. It is default value as "Yes". I wanna change it to "No" when I create a new table & field in ADOX statement. thanks dom |
#4
|
|||
|
|||
That worked for me. Thaks for helping me out!
John "Brendan Reynolds" wrote: Now I remember why I dislike ADOX so much! :-( On testing, I can't get my original suggestion to work either. But the following seems to work. After running this code, when I look at the table in design view, the first field ("ANonNullableColumn") has the Required property set, the second field ("ANullableColumn") doesn't. Public Sub TestNullable() Dim cat As ADOX.Catalog Dim tbl As ADOX.Table Dim col1 As ADOX.Column Dim col2 As ADOX.Column Set cat = New ADOX.Catalog cat.ActiveConnection = CurrentProject.Connection Set tbl = cat.Tables("tblTest") Set col1 = New ADOX.Column With col1 .Name = "ANonNullableColumn" .Type = adInteger End With tbl.Columns.Append col1 Set col2 = New ADOX.Column With col2 .Name = "ANullableColumn" .Type = adInteger .Attributes = adColNullable '------------------------------------NB End With tbl.Columns.Append col2 End Sub -- Brendan Reynolds (MVP) "John S" wrote in message ... I'm trying to do the same thing. Can't figure out the syntax Dim oTbl As ADOX.Table Set oTbl = New ADOX.Table 'Add field oTbl.Columns.Append "lngTestValue", adInteger ' this works, but now I want to set the "Nullable" property to true. 'I tried a bunch of things, but can't find the right syntax. "Brendan Reynolds" wrote: There is no "Required" property in ADOX. In ADOX, set the Nullable property to False to require entry in a field, or True to allow records with no entry in the field. -- Brendan Reynolds (MVP) dom wrote in message ... How am I change the "required" property in the field column in ADOX. It is default value as "Yes". I wanna change it to "No" when I create a new table & field in ADOX statement. thanks dom |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can't change font size in HTML-formatted messages being sent | Norm Dresner | Outlook Express | 9 | January 16th, 2005 11:06 PM |
Global Margin Change | John Smith | Publisher | 1 | December 15th, 2004 09:56 PM |
Change text box property via code | Burt | Using Forms | 2 | December 8th, 2004 07:55 PM |
Change Start Dates without Changing Due Dates | Beth | General Discussion | 0 | August 19th, 2004 03:44 PM |
Alter Table Query to Change Accept Zero Length Property ? | DCCNET.NEWS | Database Design | 1 | August 14th, 2004 08:10 AM |