Solved

(VB DBF) Updating Blank Date in recordset

Posted on 2001-08-20
5
312 Views
Last Modified: 2011-09-20
I need to know how to update a date in a FoxPro recordset to be blank. I keep receiving an error stating that the column is not-nullable. The option for Null values is set to 'Yes' in the connection. So, how can I assign a empty or null value to a field in a recordset??? I don't have any problem using an Access database, but for compatibility issues, I have to use dbf files.


Thanks in advance.


Miguel
0
Comment
Question by:msuarez
  • 3
5 Comments
 
LVL 10

Expert Comment

by:arana
ID: 6406965
try updating from an empty VARIANT variable, that may help you do what you what. or set your date to the "NULL DATE VALUE" wich i think it is jan-1-1899 or something like that (actually "1" is the integer value)
0
 

Expert Comment

by:MelissaEvans
ID: 6406972
How are you attempting the update?  Are you setting the field to "" (a zero length string)?  Have you tried executing a SQL statement that specifically set it to null?  You said that the "option for Null values is set to 'Yes' in the connection."  Are you using ADO or DAO?  Is the Allow Null set in the table schema itself?  

Sorry 'bout bombarding you with more questions.
~Melissa
0
 
LVL 10

Accepted Solution

by:
arana earned 100 total points
ID: 6406996
try using:

12 AM (Midnight) on 12/30/1899 (which actually is zero for the date data type.)
0
 

Author Comment

by:msuarez
ID: 6407179
Arana,

It worked just fine. Thank you.

But just out of curiosity. What happens if you have to use that specific date?



Miguel
0
 
LVL 10

Expert Comment

by:arana
ID: 6413758
well then it will be stored and retrieved as that specific date without problem.
(the problem comes when you try to use a date BEFORE that)

never tried, will be fun.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug this code 7 56
VBA/SQL - Connect to SQL server and pull data 4 88
Excel - Save a copy of work book 13 82
How does CurrentUser work? 10 31
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now