If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Changing a field
I need to change a field from a date format to year only. So instead of it
reading 1 Apr 2008 or something similar it now only contains the year, ie, 2008. I'm sure this is a ridiculously easy thing to do but not sure how to go about it as the field is already populated with data too. However, they are no longer interested in the day or month! Thanks in advance. |
#2
|
|||
|
|||
Changing a field
YearOnly:Format$([YourDateField],"yyyy")
-- Please remember to mark this post as answered if this solves your problem. "C Tate" wrote: I need to change a field from a date format to year only. So instead of it reading 1 Apr 2008 or something similar it now only contains the year, ie, 2008. I'm sure this is a ridiculously easy thing to do but not sure how to go about it as the field is already populated with data too. However, they are no longer interested in the day or month! Thanks in advance. |
#3
|
|||
|
|||
Changing a field
I am not sure I understand properly. Does this mean we will still have to
enter a day and month? Because we don't want to do that. We now only want to enter a year. Also, I am not exactly sure where/how I should enter this statement you have given me. "Ryan" wrote: YearOnly:Format$([YourDateField],"yyyy") -- Please remember to mark this post as answered if this solves your problem. "C Tate" wrote: I need to change a field from a date format to year only. So instead of it reading 1 Apr 2008 or something similar it now only contains the year, ie, 2008. I'm sure this is a ridiculously easy thing to do but not sure how to go about it as the field is already populated with data too. However, they are no longer interested in the day or month! Thanks in advance. |
#4
|
|||
|
|||
Changing a field
1. Open your table in deisgn view.
2. Add a new field of type Number. Give it a name such as InvoiceYear or TheYear - not just 'Year' because Access will get confused by a VBA function that has that name. 3. Save the change to the table, and close it. 4. Create a new query that uses this table. Change it to an update query (Update on Query menu.) Access adds an Update row to the query design grid. 5. In the Update row under the near year field, enter: Year([F1]) using your old date/time field name instead of F1. 6. Run the query. Verify the new field has the correct numbers. Close the query. (No need to save.) 7. Open the table in design view again. Delete the old date/time field. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "C Tate" wrote in message ... I need to change a field from a date format to year only. So instead of it reading 1 Apr 2008 or something similar it now only contains the year, ie, 2008. I'm sure this is a ridiculously easy thing to do but not sure how to go about it as the field is already populated with data too. However, they are no longer interested in the day or month! Thanks in advance. |
#5
|
|||
|
|||
Changing a field
If your going to change from a date field, to a simple year field, all I
would do is add another field in your table, and make it a text datatype. As for the statement, you would put that in a blank field of a query. The statement I gave you converts what you have already entered as mm/dd/yyyy to just show the year, but if all your going to do is type a year, just add a new field to your table of text data type. -- Please remember to mark this post as answered if this solves your problem. "C Tate" wrote: I am not sure I understand properly. Does this mean we will still have to enter a day and month? Because we don't want to do that. We now only want to enter a year. Also, I am not exactly sure where/how I should enter this statement you have given me. "Ryan" wrote: YearOnly:Format$([YourDateField],"yyyy") -- Please remember to mark this post as answered if this solves your problem. "C Tate" wrote: I need to change a field from a date format to year only. So instead of it reading 1 Apr 2008 or something similar it now only contains the year, ie, 2008. I'm sure this is a ridiculously easy thing to do but not sure how to go about it as the field is already populated with data too. However, they are no longer interested in the day or month! Thanks in advance. |
#6
|
|||
|
|||
Changing a field
Many thanks for an extremely clear and helpful reply. Most grateful.
"Allen Browne" wrote: 1. Open your table in deisgn view. 2. Add a new field of type Number. Give it a name such as InvoiceYear or TheYear - not just 'Year' because Access will get confused by a VBA function that has that name. 3. Save the change to the table, and close it. 4. Create a new query that uses this table. Change it to an update query (Update on Query menu.) Access adds an Update row to the query design grid. 5. In the Update row under the near year field, enter: Year([F1]) using your old date/time field name instead of F1. 6. Run the query. Verify the new field has the correct numbers. Close the query. (No need to save.) 7. Open the table in design view again. Delete the old date/time field. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "C Tate" wrote in message ... I need to change a field from a date format to year only. So instead of it reading 1 Apr 2008 or something similar it now only contains the year, ie, 2008. I'm sure this is a ridiculously easy thing to do but not sure how to go about it as the field is already populated with data too. However, they are no longer interested in the day or month! Thanks in advance. |
Thread Tools | |
Display Modes | |
|
|