Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Date

Status
Not open for further replies.

Ologhai

Programmer
Apr 11, 2000
42
0
0
CA
Hi

i've some problem with updating my recorset.

Adodc1.Recordset.addnew
Adodc1.Recordset!Date = Null
Adodc1.update

all is ok.

Adodc1.Recordset!Date = Date
Adodc1.update

all is ok.

Adodc1.Recordset!Date = Null
Adodc1.update

i have this error "Invalid Date"

why ? i want the posibility to put no date on field.

thx _____________________________
Hugues Gauthier P.A,DEC
Programmeur Analyste
Progitech GS Inc.
hugues.gauthier@progitech.com
hugues_gauthier@hotmail.com
Tel. : (418) 698-4383 #19
Fax.: (418) 698-8633
---------------------
ICQ: 2151800
 
Huhes,

This is all to do with the way VB converts values on the fly...

Dates Cannot be Null. I think they can be EMPTY, but it all depends on your table design.

Basically.

Adodc1.Recordset!Date = Null
'sets Null to the date, but CONVERTS the null on the way. so...all is OK
' All is OK
Adodc1.update

all is ok.
'Yes, because that data to be updated has
'ALREADY been converted properly


Adodc1.Recordset!Date = Date
'Date is a valid #date# field, so again
Adodc1.update

all is ok.
'because a valid datatype has been assigned to date.

Adodc1.Recordset!Date = Null' uh-oh.
'Null is NOT a valid datatype for a date field.

Adodc1.update
' BAM ! you are now trying to write invalid data
' so the DB Engine kicks back an error

i have this error "Invalid Date"

why ? i want the posibility to put no date on field.

check up the EMPTY, etc keywords in MSDN. NULL is not the only 'BLANK' datatype.

HTH

Oh yeah, and PS, don't EVER call a field 'Date'... It's more trouble than it's worth. Trust me. Call it 'thisDate' or whatever
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top