BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Remove required fields in Access

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Jhoe Logz
Guest





PostPosted: Tue Oct 03, 2006 8:11 am    Post subject: Remove required fields in Access Reply with quote



How can I remove the required fields in Access table using Delphi? It seems
the following is not working:

For FieldCtr:= 0 to AdoTable.Fields.Count - 1 do
AdoTable.Fields.Field[FieldCtr].Required:=False;

Whenever I checked the Access table the first field is still "Required=Yes."

Also, how to set the Allow Zero Length=True (Yes) from Delphi?

Thanks for any help.
Back to top
Brian Hollister
Guest





PostPosted: Tue Oct 03, 2006 7:56 pm    Post subject: Re: Remove required fields in Access Reply with quote



I had the same issue, I think.

{03.29.06 bkh There is a bug in TCustomADODataSet.InternalInitFieldDefs that
causes the "Required" property of all TFieldDefs (and consequently all
TFields)
of an ADO dataset to always be false, even though the table fields may have
been created "NOT NULL", i.e. the field does not allow NULLs. Scanning
through
ADODB.pas I found no indication that the Required property is ever set, so
it
defaults to false.

I added the workaround listed at
http://qc.borland.com/wc/qcmain.aspx?d=6264. The
QC Entry Number is 6264.
}

hth,

brian

PS - Bear in mind i develop against MS SQL 2000. There may be a difference
due to Access, i dont recall the exact text of the QC entry.

--
Got a big event coming up? Let us
help coordinate your event. For more
visit www.kissemgoodbye.com
"Jhoe Logz" <eric (AT) smsglobal (DOT) com> wrote in message
news:452210b3 (AT) newsgroups (DOT) borland.com...
Quote:
How can I remove the required fields in Access table using Delphi? It
seems
the following is not working:

For FieldCtr:= 0 to AdoTable.Fields.Count - 1 do
AdoTable.Fields.Field[FieldCtr].Required:=False;

Whenever I checked the Access table the first field is still
"Required=Yes."

Also, how to set the Allow Zero Length=True (Yes) from Delphi?

Thanks for any help.



Back to top
Brian Bushay TeamB
Guest





PostPosted: Wed Oct 04, 2006 6:09 am    Post subject: Re: Remove required fields in Access Reply with quote



Quote:
How can I remove the required fields in Access table using Delphi? It seems
the following is not working:

For FieldCtr:= 0 to AdoTable.Fields.Count - 1 do
AdoTable.Fields.Field[FieldCtr].Required:=False;

Whenever I checked the Access table the first field is still "Required=Yes."
Delphi isn't going to change your Access database. If the table's field is

required in Access it is going to stay that way until you change it in Access.
Normally if you have a key field as the first field in a table that field will
be required.

Quote:

Also, how to set the Allow Zero Length=True (Yes) from Delphi?
The only way to do this is by using ADOX which you can do if you import the ADOX

type library.
Then you would use code like this

var
Catalog1. : Catalog;
begin

Catalog1. := CoCatalog.Create;
Catalog1._Set_ActiveConnection(ADOConnection1.ConnectionObject);

Catalog1.Tables['TheTableName'].Columns['TheColumName'].Properties['Jet
OLEDB:Allow Zero Length'].Value = True;



--
Brian Bushay (TeamB)
Bbushay (AT) NMPLS (DOT) com
Back to top
Jhoe Logz
Guest





PostPosted: Wed Oct 04, 2006 8:44 pm    Post subject: Re: Remove required fields in Access Reply with quote

Brian Bushay TeamB wrote:
Quote:
The only way to do this is by using ADOX which you can do if you import the ADOX
type library.
Then you would use code like this

var
Catalog1. : Catalog;
begin

Catalog1. := CoCatalog.Create;
Catalog1._Set_ActiveConnection(ADOConnection1.ConnectionObject);

Catalog1.Tables['TheTableName'].Columns['TheColumName'].Properties['Jet
OLEDB:Allow Zero Length'].Value = True;

Thanks Brian! I also used ADOX to remove the required field at
runtime while creating the Access table.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.