Clearing date Field

B

BR

I have a program that checks if a record if closed by querying the date field
in a table. If the user wants to reopen the record, I need to clear the date
field in the table. How can you clear the date field from a table. Date
field is derfined as Date.

The table is in Access 2000.
Thanks
Bob
 
M

Marshall Barton

BR said:
I have a program that checks if a record if closed by querying the date field
in a table. If the user wants to reopen the record, I need to clear the date
field in the table. How can you clear the date field from a table. Date
field is derfined as Date.


If it's the current record in a form, set the field to Null.

If it's only a record in a table, Execute an Update query to
set it to Null.
 
D

Douglas J. Steele

The usual way would be to make the field Not Required, and to set it to
Null.
 
B

BR

I'm using VB 6.0 as a front-end. I posted here due to the Access back-end.
I've tried the following:

rs.edit
rs!ClosedDate=vbNull
rs.Update

This results in an error.
 
F

fredg

I'm using VB 6.0 as a front-end. I posted here due to the Access back-end.
I've tried the following:

rs.edit
rs!ClosedDate=vbNull
rs.Update

This results in an error.

Not vbNull, but Null works for me.
vbNull has a value of 1

rs.edit
rs!ClosedDate= Null
rs.Update
 
M

Marshall Barton

BR said:
I'm using VB 6.0 as a front-end. I posted here due to the Access back-end.
I've tried the following:

rs.edit
rs!ClosedDate=vbNull
rs.Update

This results in an error.


Assuming the field is not a Required field, that shouldn't
generate an error (even if it is the wrong value).

My object browser tells me that vbNull has a value of 1. I
don't use VB, but I would expect it to have Null as a
literal value, which is what you want to assign to the
field.

rs!ClosedDate = Null

If the date field is Required, you will not be able to
"clear" it, no matter what you try.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top