Record update problem

I am connecting to an oracle database thru VB. One of the fields I am working with is a date field. If the date field already has a date in it, and I delete the date, and then update the record, I get an error, rather than the date being 'erased'. Any suggestions as to why this is happening would be appreciated.~~~~Crit
CritAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
mark2150Connect With a Mentor Commented:
Seen quite a bit of discussion on this in the VBData list I subscribe to. Seems that you *CAN'T* leave clear a date field to a blank. The conversion from Date data type does not allow for *no* value, everything will evaluate to *some* date. 0/0/00 doesn't work because it's not a valid date. The only solution that I've seen is to set it to some *bizzarre* date well out of range and use that as a "no date" value. Your display code will then need some logic to detect the out of range value and display something meaningful. Problem comes when you're dealing with people's birthdates and two digit years. Since it's not all that uncommon for people to live for 100 years or more you're going to get painted into a corner where there is *NO* valid "no date" value with a two digit year. (sigh).

Only way out is to recast the database and change the field type from Date to Text and then you can place in null values. *BUT* downside is that you lose the inherent validation and system location independence that DATE provides.

M

0
 
caraf_gCommented:
Crit,

Maybe the date field was defined as "NOT NULL" in your database?

In that case it cannot be empty.
0
 
CritAuthor Commented:
caraf_g,
I just checked the database, and that is not the case. I can, through, SQL Plus update the date to an empty string, just not through VB
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
caraf_gCommented:
Can you show me the line of code that's causing the problem?
0
 
ZenMasterCommented:
Have you tried to send a 00/00/00 value to the field being deleted?
0
 
jjmartinCommented:
What is the exact error message you are getting?  Perhaps you are trying to fill the field with invalid data such as slashes from an input mask, but no date?
0
 
CritAuthor Commented:
thanx for your help...........I'll let my boss sweat the rest!
Crit
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.