PC Review


Reply
Thread Tools Rate Thread

Default value of a field

 
 
William
Guest
Posts: n/a
 
      28th Jan 2009
I have a field "Date" in a table and would like for the Default Value of this
field to be the current date for a new entry.
In the default value I have tried putting in Today() and =Today() as well as
Now() and =Now(). None have worked.
How can I accomplish what I am trying to do.
ACCESS 2007
Thanks!!!!!
 
Reply With Quote
 
 
 
 
Jim Burke in Novi
Guest
Posts: n/a
 
      28th Jan 2009
I just tried using date() as a default value and it worked fine - that's the
function you'd want to use if you just want the date (Now() gives date and
time). The only thing I can think of is that your tables are linked and
you're trying to set the default from the front end rather than from the back
end DB. Also, you should not name the field Date, since that is an Access
function name!

"William" wrote:

> I have a field "Date" in a table and would like for the Default Value of this
> field to be the current date for a new entry.
> In the default value I have tried putting in Today() and =Today() as well as
> Now() and =Now(). None have worked.
> How can I accomplish what I am trying to do.
> ACCESS 2007
> Thanks!!!!!

 
Reply With Quote
 
William
Guest
Posts: n/a
 
      28th Jan 2009
Thanks Jim. I just changed the field name from "Date" to "DT." I just tried
again to put in Date() as a default value. I get the error message: "compile
error. in table validation expression." Thanks again.

"Jim Burke in Novi" wrote:

> I just tried using date() as a default value and it worked fine - that's the
> function you'd want to use if you just want the date (Now() gives date and
> time). The only thing I can think of is that your tables are linked and
> you're trying to set the default from the front end rather than from the back
> end DB. Also, you should not name the field Date, since that is an Access
> function name!
>
> "William" wrote:
>
> > I have a field "Date" in a table and would like for the Default Value of this
> > field to be the current date for a new entry.
> > In the default value I have tried putting in Today() and =Today() as well as
> > Now() and =Now(). None have worked.
> > How can I accomplish what I am trying to do.
> > ACCESS 2007
> > Thanks!!!!!

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      28th Jan 2009
On Wed, 28 Jan 2009 14:16:01 -0800, William
<(E-Mail Removed)> wrote:

>Thanks Jim. I just changed the field name from "Date" to "DT." I just tried
>again to put in Date() as a default value. I get the error message: "compile
>error. in table validation expression." Thanks again.


That certainly sounds like... you have a compile error in the table validation
expression, which is a different property than the default value.

Open the table in design view, view its Properties - what if anything is in
the table validation rule?

--

John W. Vinson [MVP]
 
Reply With Quote
 
Dale Fye
Guest
Posts: n/a
 
      29th Jan 2009
Although you probably do need to figure out what is causing the error
messge, another way to get around setting the default value of the field is
to set the default value of the control that it is bound to.

Just an idea.

Dale

"William" <(E-Mail Removed)> wrote in message
news:5760D9FB-9C20-432F-91CC-(E-Mail Removed)...
>I have a field "Date" in a table and would like for the Default Value of
>this
> field to be the current date for a new entry.
> In the default value I have tried putting in Today() and =Today() as well
> as
> Now() and =Now(). None have worked.
> How can I accomplish what I am trying to do.
> ACCESS 2007
> Thanks!!!!!



 
Reply With Quote
 
William
Guest
Posts: n/a
 
      29th Jan 2009
Hello John,

Thanks for you help. There was nothing in the Validation Rule. But today I
opened up Access, put in Date() again, and it looks like it is working fine.
I don't know what I could have been doing wrong yesterday. Thanks for your
help!!!

"John W. Vinson" wrote:

> On Wed, 28 Jan 2009 14:16:01 -0800, William
> <(E-Mail Removed)> wrote:
>
> >Thanks Jim. I just changed the field name from "Date" to "DT." I just tried
> >again to put in Date() as a default value. I get the error message: "compile
> >error. in table validation expression." Thanks again.

>
> That certainly sounds like... you have a compile error in the table validation
> expression, which is a different property than the default value.
>
> Open the table in design view, view its Properties - what if anything is in
> the table validation rule?
>
> --
>
> John W. Vinson [MVP]
>

 
Reply With Quote
 
William
Guest
Posts: n/a
 
      29th Jan 2009
Hello Dale,
Thanks for you help. Today I opened up Access, put in Date() again, and it
looks like it is working fine. I don't know what I could have been doing
wrong yesterday. Thanks for your help!!!


"Dale Fye" wrote:

> Although you probably do need to figure out what is causing the error
> messge, another way to get around setting the default value of the field is
> to set the default value of the control that it is bound to.
>
> Just an idea.
>
> Dale
>
> "William" <(E-Mail Removed)> wrote in message
> news:5760D9FB-9C20-432F-91CC-(E-Mail Removed)...
> >I have a field "Date" in a table and would like for the Default Value of
> >this
> > field to be the current date for a new entry.
> > In the default value I have tried putting in Today() and =Today() as well
> > as
> > Now() and =Now(). None have worked.
> > How can I accomplish what I am trying to do.
> > ACCESS 2007
> > Thanks!!!!!

>
>
>

 
Reply With Quote
 
William
Guest
Posts: n/a
 
      29th Jan 2009
Hello Jim,
Thanks for you help. Today I opened up Access, put in Date() again, and it
looks like it is working fine. I don't know what I could have been doing
wrong yesterday. Thanks for your help!!!



"Jim Burke in Novi" wrote:

> I just tried using date() as a default value and it worked fine - that's the
> function you'd want to use if you just want the date (Now() gives date and
> time). The only thing I can think of is that your tables are linked and
> you're trying to set the default from the front end rather than from the back
> end DB. Also, you should not name the field Date, since that is an Access
> function name!
>
> "William" wrote:
>
> > I have a field "Date" in a table and would like for the Default Value of this
> > field to be the current date for a new entry.
> > In the default value I have tried putting in Today() and =Today() as well as
> > Now() and =Now(). None have worked.
> > How can I accomplish what I am trying to do.
> > ACCESS 2007
> > Thanks!!!!!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create field default using the ID field in Access 2007 JimG Microsoft Access Database Table Design 0 13th Jul 2008 05:34 PM
using a function w/table field to enter default in another field =?Utf-8?B?dHJleA==?= Microsoft Access VBA Modules 1 12th Sep 2007 01:54 PM
copy first line in a field to a new field as a default value =?Utf-8?B?QW5naWU=?= Microsoft Access Forms 4 15th Aug 2005 11:18 PM
Default Value of field based on another field of same record =?Utf-8?B?TmFyZXNoIEt1bWFyIFNhaW5p?= Microsoft Access Getting Started 5 24th May 2005 03:11 AM
calculated date field as default in a bound field Deb Microsoft Access Forms 1 9th Feb 2004 11:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:46 AM.