?
Solved

How to set Oracle date to null with ODBC?

Posted on 2002-07-05
4
Medium Priority
?
1,496 Views
Last Modified: 2008-03-17
Does anyone know how to set an Oracle date field to null using ODBC?  

My code statement is the following:
rs.Fields("BillingDate") = IIf(IsNull(Me.txtBillingDate), Null, Trim(Me.txtBillingDate))

I get an error everytime it gets executed.  The Errors collection returns that there was a data type mismatch.   I have read articles that say that you can't assign an Oracle date the null value using ODBC.  However, I have some older code examples where I was able to do this.  Not sure why it isn't working now.  

I don't want to have to use SQLPassThrough queries (Insert, Update statements) because of the time involved.

Any ideas?
Thanks.
0
Comment
Question by:mnord
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Author Comment

by:mnord
ID: 7132284
I am using VB6 with DAO and Oracle 8i.
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 400 total points
ID: 7133250
Try this:
rs.Fields("BillingDate") = IIf(Len(Trim$(Me.txtBillingDate)) = 0 , Null, Trim(Me.txtBillingDate))

Or better still (easier to read):

Dim sBillingDate As String

SBillingDate = Trim$(Me.txtBillingDate)
If Len(sBillingDate) Then
   rs.Fields("BillingDate").Value = sBillingDate
Else
   rs.Fields("BillingDate").Value = Null
End if

Anthony
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7990736
Hi mnord,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept acperkins@devx's comment(s) as an answer.

mnord, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8053108
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

752 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