Default value of a field

W

William

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!!!!!
 
J

Jim Burke in Novi

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!
 
W

William

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.
 
J

John W. Vinson

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?
 
D

Dale Fye

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
 
W

William

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!!!
 
W

William

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!!!
 
W

William

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!!!
 

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