A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Change Field.required property in ADOX



 
 
Thread Tools Display Modes
  #1  
Old February 3rd, 2005, 03:54 AM
external usenet poster
 
Posts: n/a
Default 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  
Old February 16th, 2005, 07:49 PM
John S
external usenet poster
 
Posts: n/a
Default

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  
Old February 16th, 2005, 09:43 PM
Brendan Reynolds
external usenet poster
 
Posts: n/a
Default


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  
Old February 21st, 2005, 10:13 PM
John S
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 06:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.