Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cannot Delete Dates

0 views
Skip to first unread message

Christopher

unread,
Jul 7, 1998, 3:00:00 AM7/7/98
to

Alright, I've got a VB form with several text boxes bound to date fields in
an Access 97 (Jet 3.5) database via a standard data control. My problem
is, that a user cannot DELETE a date because the empty field causes an
error - once a date goes into that field, you can't get it out. At all.
Ever.

How do I work around this? How do I allow the user to remove a date from a
date field if, for example, they entered it by mistake, or decide that that
field should remain blank?

Thanks in Advance.

--
Christopher G. Carnahan
christopher...@odot.state.or.us

romad

unread,
Jul 8, 1998, 3:00:00 AM7/8/98
to
The problem arised because the data control can't set a field of a resultset
to NULL, it tries to send an empty string that is not a valid date, and Jet
complaints it. You must test in the Validate event what your date control
are empty and set the corresponding recordet field to NULL. Also set the
DataChanged property of those controls to False, so the data control don't
try to write them back to Jet.

Mike Davies

unread,
Jul 8, 1998, 3:00:00 AM7/8/98
to
Go into Access design mode and check your table. Is the date field the Key
field or is it flagged as 'Required'? If so change these requirements and it
should be possible to enter a blank.

Kind Regards Mike Davies
Christopher wrote in message <01bda9cd$b28f5690$aa4783a7@nt7951a>...

Stewart McGuire

unread,
Jul 22, 1998, 3:00:00 AM7/22/98
to Mike Davies
I have the same problem as Christopher. No the field is NOT a key field, and no
it is NOT marked "Required."
DAO returns a data conversion error.


Mike Davies wrote:

****************************************************************************
* Stewart McGuire EMail: smcg...@pirnie.com
* Web Application Developer Phone: (914) 641-2911
* Malcolm Pirnie, Inc. Fax: (914) 641-2458
****************************************************************************

frankm...@my-dejanews.com

unread,
Jul 24, 1998, 3:00:00 AM7/24/98
to smcg...@westnet.com
Have you tried setting the date field = NULL? Works for me, though it wasn't
obvious.

> I have the same problem as Christopher. No the field is NOT a key field, and
no
> it is NOT marked "Required."
> DAO returns a data conversion error.
>
> Mike Davies wrote:
>
> > Go into Access design mode and check your table. Is the date field the Key
> > field or is it flagged as 'Required'? If so change these requirements and it
> > should be possible to enter a blank.
> >
> > Kind Regards Mike Davies
> > Christopher wrote in message <01bda9cd$b28f5690$aa4783a7@nt7951a>...
> > >
> > >Alright, I've got a VB form with several text boxes bound to date fields in
> > >an Access 97 (Jet 3.5) database via a standard data control. My problem
> > >is, that a user cannot DELETE a date because the empty field causes an
> > >error - once a date goes into that field, you can't get it out. At all.
> > >Ever.
> > >
> > >How do I work around this? How do I allow the user to remove a date from a
> > >date field if, for example, they entered it by mistake, or decide that that
> > >field should remain blank?

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum

Karen Luhrs

unread,
Jul 27, 1998, 3:00:00 AM7/27/98
to
This was given to me as a solution and works great..

This works:

Private Sub Data1_Validate(Action As Integer, Save As Integer)
If txtDtNext = "" Then
Data1.Recordset.Edit
Data1.Recordset!dtNext = Null
Data1.Recordset.Update

txtDtNext.DataChanged = False
End If
End Sub

Stewart McGuire wrote in message <35B622B7...@westnet.com>...


>I have the same problem as Christopher. No the field is NOT a key field,
and no
>it is NOT marked "Required."
>DAO returns a data conversion error.
>
>
>Mike Davies wrote:
>
>> Go into Access design mode and check your table. Is the date field the
Key
>> field or is it flagged as 'Required'? If so change these requirements and
it
>> should be possible to enter a blank.
>>
>> Kind Regards Mike Davies
>> Christopher wrote in message <01bda9cd$b28f5690$aa4783a7@nt7951a>...
>> >
>> >Alright, I've got a VB form with several text boxes bound to date fields
in
>> >an Access 97 (Jet 3.5) database via a standard data control. My problem
>> >is, that a user cannot DELETE a date because the empty field causes an
>> >error - once a date goes into that field, you can't get it out. At all.
>> >Ever.
>> >
>> >How do I work around this? How do I allow the user to remove a date
from a
>> >date field if, for example, they entered it by mistake, or decide that
that
>> >field should remain blank?
>> >

0 new messages