Solved

Record update problem

Posted on 1999-01-22
7
140 Views
Last Modified: 2010-05-03
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
0
Comment
Question by:Crit
7 Comments
 
LVL 10

Expert Comment

by:caraf_g
ID: 1470081
Crit,

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

In that case it cannot be empty.
0
 

Author Comment

by:Crit
ID: 1470082
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
 
LVL 10

Expert Comment

by:caraf_g
ID: 1470083
Can you show me the line of code that's causing the problem?
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 1

Expert Comment

by:ZenMaster
ID: 1470084
Have you tried to send a 00/00/00 value to the field being deleted?
0
 
LVL 3

Expert Comment

by:jjmartin
ID: 1470085
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
 
LVL 12

Accepted Solution

by:
mark2150 earned 100 total points
ID: 1470086
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
 

Author Comment

by:Crit
ID: 1470087
thanx for your help...........I'll let my boss sweat the rest!
Crit
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB error "Type mismatch" 2 54
Add and format columns in vb6 7 57
Problem to With line 4 57
Advice in Xamarin 21 79
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question