Allowing a date field to be null value

Allowing a date field to be null value

Post by Ganes Vaidhyanatha » Mon, 02 Sep 1996 04:00:00



hi:

I,m writing a software for one of the departments of Louisiana State
university.I have a question regarding this.

I'm using MS Access 2.0 as back end and Visual basic 4.0 as front end.
I have a mask edit box for the date field and the data type for this has
been declared as date/Time in the table in access.

The system is giving an error message when i leave the date field blank.

How do i overcome this.I want to code in such a way that even if they
don't enter anything in this mask edit box the record should be
accepted.

I would appreciate if you can give me the code.

If you need some more clarifications you can E_mail me.I will be glad to
answer you.

Thanx

ganesh

 
 
 

Allowing a date field to be null value

Post by Peter Mikalajun » Tue, 03 Sep 1996 04:00:00


On Sun, 01 Sep 1996 11:37:17 -0500, Ganes Vaidhyanathan


>hi:

>I,m writing a software for one of the departments of Louisiana State
>university.I have a question regarding this.

>I'm using MS Access 2.0 as back end and Visual basic 4.0 as front end.
>I have a mask edit box for the date field and the data type for this has
>been declared as date/Time in the table in access.

>The system is giving an error message when i leave the date field blank.

You mean when you attempt to add a new record, yes?

Quote:>How do i overcome this.I want to code in such a way that even if they
>don't enter anything in this mask edit box the record should be
>accepted.

>I would appreciate if you can give me the code.

>If you need some more clarifications you can E_mail me.I will be glad to
>answer you.

If the field is _not_ part of the primary key, then use Access to correct
the problem.  Bring up Access and open you database.  Select the table
and go into design mode.  Find your field and set the required attribute to
"NO".  That is all there is to it.

If the field  is part of the primary key. Do the above, then set the
atribute for the key to accept null values.

Peter Mikalajunas

http://www.xnet.com/~kd9fb

 
 
 

Allowing a date field to be null value

Post by Umesh Murth » Wed, 04 Sep 1996 04:00:00


Depends on how your database has been setup.  What is the error message and
what
has the field in question been set up as.  Are NULL allowed on this field,
You must reconsider the design of this field if so. Why is a field that has
been setup for
NO NULL's being set to a NULL.  If you really don't want to have a NOT NULL
constraint on
this field, remove it. Otherwise set the value up properly in the Text box.

While I would not recommend this method, you can try this to get around the
problem
through the back door.
One way around this would be to write code in the LOST_FOCUS event handler
for the
masked test box.  If the Len(text) = 0 then set the text = "" .  This will
force an empty
value to be written to the field.

Best regards
Umesh Murthy



Quote:> hi:

> I,m writing a software for one of the departments of Louisiana State
> university.I have a question regarding this.

> I'm using MS Access 2.0 as back end and Visual basic 4.0 as front end.
> I have a mask edit box for the date field and the data type for this has
> been declared as date/Time in the table in access.

> The system is giving an error message when i leave the date field blank.

> How do i overcome this.I want to code in such a way that even if they
> don't enter anything in this mask edit box the record should be
> accepted.

> I would appreciate if you can give me the code.

> If you need some more clarifications you can E_mail me.I will be glad to
> answer you.

> Thanx

> ganesh

 
 
 

1. Null date values in Date/Time fields in Access DB

Sorry if this is a newbie question, but I have a Access DB with
date fields. The problem is that this date can be left blank when the
record is created. If I do this (leave it blank) I then get 'type
mismatch' when I do a search for this value using an SQL query.
I use this
 if NOT Mydynaset("DateConfirmed") = ""
which gives 'Type Mismatch'
Should I be testing for IsNull?
Or should I make the field in the Database a Text field so that I can
have a blank (zero-length string) value? Surely there must be many databases
out there where a date field can be empty.

All help gratefully received.
--
Simon Rayner
Why not walk Offa's Dyke this year? 177 miles of uncrowded countryside.
The Dyke is more than 1200 years old. Email me for more details.

2. Kaplhagh !

3. How do I allow NULL value on a required field in disconnected recordset

4. Simple question (i think)

5. nulls not allowed to nulls allowed

6. SQL Mail

7. force NULL in fields that don't allow NULL

8. Turning off logging

9. Check for NULL field value without returning field value

10. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

11. How to give Date fields null values?

12. NULL Values for passed date field???

13. Passing a NULL value into a date time field