Default value in date filed on form

  • Thread starter jubiiab via AccessMonster.com
  • Start date
J

jubiiab via AccessMonster.com

Hi

I need a default value in my DATE field and I want the default value to be
like 00-00-0000 but right now I can only make the default value as 00:00:00.

Do anyone know how to change the default value to the format I want? In my
text field I use “-“ as a default field but I can’t use that in date fields.
 
D

Douglas J. Steele

Date fields can only accept valid dates, and 00-00-0000 is not a valid date.

The earliest date Access will accept for a Date field is 01 January, 100.
 
J

jubiiab via AccessMonster.com

What can I then do then? I have a form with some DATE fields. I also have a
log-file that registers every time some one changes some data on the form. On
the log-file you see the before value and after value and it only register
when you change some data. If they fill out a new form/record it doesn’t
register….as it should.

I have some records that have some empty DATE fields. And when a user enters
a DATE and save the record, the log-file is not registering that field
because it was empty before. I want it to somehow register the empty field as
before value. How can I do that when it need some kind of a value?

Date fields can only accept valid dates, and 00-00-0000 is not a valid date.

The earliest date Access will accept for a Date field is 01 January, 100.
[quoted text clipped - 5 lines]
text field I use "-" as a default field but I can't use that in date
fields.
 
D

Douglas J. Steele

You could set the DefaultValue to a valid date, say 01-01-100

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jubiiab via AccessMonster.com said:
What can I then do then? I have a form with some DATE fields. I also have
a
log-file that registers every time some one changes some data on the form.
On
the log-file you see the before value and after value and it only register
when you change some data. If they fill out a new form/record it doesn't
register..as it should.

I have some records that have some empty DATE fields. And when a user
enters
a DATE and save the record, the log-file is not registering that field
because it was empty before. I want it to somehow register the empty field
as
before value. How can I do that when it need some kind of a value?

Date fields can only accept valid dates, and 00-00-0000 is not a valid
date.

The earliest date Access will accept for a Date field is 01 January, 100.
[quoted text clipped - 5 lines]
text field I use "-" as a default field but I can't use that in date
fields.
 
J

jubiiab via AccessMonster.com

Then I would get a big problem because if a date is overdue then it turns red
and showed on the overdue list. I would have alot of 01-01-100 on the list
right?
You could set the DefaultValue to a valid date, say 01-01-100
What can I then do then? I have a form with some DATE fields. I also have
a
[quoted text clipped - 21 lines]
 
D

Douglas J. Steele

If you're trying to only have the legitimate dates on the overdue list, have
the date field default to Null, as opposed to any specific value.

In the query that makes up the overdue list, use Nz([MyDateField], Date)
instead of simply referring to MyDateField. In that way, the Null values
will appear as today's date.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


jubiiab via AccessMonster.com said:
Then I would get a big problem because if a date is overdue then it turns
red
and showed on the overdue list. I would have alot of 01-01-100 on the list
right?
You could set the DefaultValue to a valid date, say 01-01-100
What can I then do then? I have a form with some DATE fields. I also
have
a
[quoted text clipped - 21 lines]
text field I use "-" as a default field but I can't use that in date
fields.
 
J

jubiiab via AccessMonster.com

when i type in the DATE field: 01-01-100
I get a messagebox about Owerflow?????
Then I would get a big problem because if a date is overdue then it turns red
and showed on the overdue list. I would have alot of 01-01-100 on the list
right?
You could set the DefaultValue to a valid date, say 01-01-100
[quoted text clipped - 3 lines]
 
J

jubiiab via AccessMonster.com

Hi I just played with the logfile code and added IsNull like this
If IsNull(.Value) <> IsNull(.OldValue) Then......etc.

and now it also register empty fields. But if you have an answer about the
overflow problem please tell me. I would be nice to know thanks!

when i type in the DATE field: 01-01-100
I get a messagebox about Owerflow?????
Then I would get a big problem because if a date is overdue then it turns red
and showed on the overdue list. I would have alot of 01-01-100 on the list
[quoted text clipped - 5 lines]
 
D

Douglas J. Steele

Where were you typing that value? Into a text box bound to the date field?
Into the field itself when the table (or a query based on the table) was
open? Into the DefaultValue property for the field when the table was open
in Design view? Somewhere else?

If you were trying to set the DefaultValue, try #01-01-100#

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jubiiab via AccessMonster.com said:
Hi I just played with the logfile code and added IsNull like this
If IsNull(.Value) <> IsNull(.OldValue) Then......etc.

and now it also register empty fields. But if you have an answer about the
overflow problem please tell me. I would be nice to know thanks!

when i type in the DATE field: 01-01-100
I get a messagebox about Owerflow?????
Then I would get a big problem because if a date is overdue then it turns
red
and showed on the overdue list. I would have alot of 01-01-100 on the
list
[quoted text clipped - 5 lines]
text field I use "-" as a default field but I can't use that in date
fields.
 
J

jubiiab via AccessMonster.com

okay, i just typed the date 01-01-100 in the text box on the form and got
that message about overflow.
Where were you typing that value? Into a text box bound to the date field?
Into the field itself when the table (or a query based on the table) was
open? Into the DefaultValue property for the field when the table was open
in Design view? Somewhere else?

If you were trying to set the DefaultValue, try #01-01-100#
Hi I just played with the logfile code and added IsNull like this
If IsNull(.Value) <> IsNull(.OldValue) Then......etc.
[quoted text clipped - 12 lines]
 
D

Douglas J. Steele

Do you have dashes set as your date separator in Regional Settings (in the
Control Panel)?

See whether 01/01/100 works any better typing into the text box.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jubiiab via AccessMonster.com said:
okay, i just typed the date 01-01-100 in the text box on the form and got
that message about overflow.
Where were you typing that value? Into a text box bound to the date field?
Into the field itself when the table (or a query based on the table) was
open? Into the DefaultValue property for the field when the table was open
in Design view? Somewhere else?

If you were trying to set the DefaultValue, try #01-01-100#
Hi I just played with the logfile code and added IsNull like this
If IsNull(.Value) <> IsNull(.OldValue) Then......etc.
[quoted text clipped - 12 lines]
text field I use "-" as a default field but I can't use that in
date
fields.
 

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