Solved

How to set Oracle date to null with ODBC?

Posted on 2002-07-05
4
1,492 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
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 100 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 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