Re: How to reset or clear a date field

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Thu, 13 Aug 2009 11:40:17 -0700, "Bob Butler" <noway@xxxxxxxxxxx>
wrote:


"Martin" <ironwoodcanyon@xxxxxxxxx> wrote in message
news:vek885t39mo2dvhpe61ng0fbepv2120khu@xxxxxxxxxx
I have a MSAccess database that is created and maintained by my VB6
program. In one of the tables, there are a couple of "date" fields
(declared at the time of creation as type: dbDate). When a new record
is added to this table (by my VB6 program), these fields are ignored -
no date is put in them. Later on, various conditions in the program
update these fields with the current time and date.

I now have a situation where I want to clear this field of any data;
that is, I want it to be as it was before any time and date was stored
in it. So, my question is: what do I set this field to? Do I assign ""
to it? Or vbNull? Or what?

Update thetablename Set datefield1=null, datefield2=null

Your example seems to be an SQL statement. I don't know if it makes
any difference but I'm not doing the updates with SQL. Here's what I'm
doing:

I have a recordset globally declared and opened. Then I execute
statements like these:

rsMainData.Edit
rsMainData.Fields("FieldA").Value = "ABCD"
rsMainData.Fields("FieldB").Value = 1234
rsMainData.Fields("DateField").Value = Now
rsMainData.Update

So, to "clear" the DateField, would I set thus:
rsMainData.Fields("DateField").Value = vbNull

.



Relevant Pages

  • Re: How to reset or clear a date field
    ... (declared at the time of creation as type: dbDate). ... is added to this table (by my VB6 program), ... Or vbNull? ...
    (microsoft.public.vb.general.discussion)
  • Custom dynamic SQl statement
    ... I am still having no luck with the creation of a custom sql statement. ...
    (comp.lang.java.databases)
  • Re: Custom dynamic SQl statement
    ... > I am still having no luck with the creation of a custom sql statement. ...
    (comp.lang.java.databases)
  • Re: Custom dynamic SQl statement
    ... >> I am still having no luck with the creation of a custom sql statement. ...
    (comp.lang.java.databases)
  • Re: How to reset or clear a date field
    ... Your example seems to be an SQL statement. ... any difference but I'm not doing the updates with SQL. ... So, to "clear" the DateField, would I set thus: ... rsMainData.Fields.Value = vbNull ...
    (microsoft.public.vb.general.discussion)