dbTalk Databases Forums  

Help needed with Access - please help a newbie

comp.databases.ms-access comp.databases.ms-access


Discuss Help needed with Access - please help a newbie in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Neil Hindry
 
Posts: n/a

Default Help needed with Access - please help a newbie - 01-04-2005 , 08:57 AM






I wonder if you can help me.

I am new to Access database and I am struggling to do what I want.

I am setting up my table and one of the fields I want the default value to
be the current year. I set the field type I tried using the date$()
function but that gives me the whole date i.e. day month & year in the
format dd/mm/yyyy. I set the data type for the field as date\Time.
All I want is the year in my field (i.e. 2005).

How do I make the current year the default value in a field and what do I
set the data type to? Please do not be too technical as I am only just
starting using Access.

I hope you are able to help.

I appreciate any help or information given.

Thanks!




Reply With Quote
  #2  
Old   
jv
 
Posts: n/a

Default Re: Help needed with Access - please help a newbie - 01-04-2005 , 09:07 AM






You can use year(date()).


Reply With Quote
  #3  
Old   
fredg
 
Posts: n/a

Default Re: Help needed with Access - please help a newbie - 01-04-2005 , 11:50 AM



On Tue, 4 Jan 2005 14:57:58 -0000, Neil Hindry wrote:

Quote:
I wonder if you can help me.

I am new to Access database and I am struggling to do what I want.

I am setting up my table and one of the fields I want the default value to
be the current year. I set the field type I tried using the date$()
function but that gives me the whole date i.e. day month & year in the
format dd/mm/yyyy. I set the data type for the field as date\Time.
All I want is the year in my field (i.e. 2005).

How do I make the current year the default value in a field and what do I
set the data type to? Please do not be too technical as I am only just
starting using Access.

I hope you are able to help.

I appreciate any help or information given.

Thanks!
What you do depends upon what you intend to do with the data.
To actually store the year value in a table, as a number, i.e. 2005,
you would set the field's datatype to Number, Field Size to Integer,
and set the default property to
= Year(Date())

To actually store the year is probably not necessary and not a good
idea.
Simply store the date.
You can use the stored date value to do anything that you would have
done just storing the Year as a number.

For example, to display the year, using the date as the value, simply
set the Format property of the control to:
yyyy

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.