Results 1 to 6 of 6
  1. #1
    cuddles is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    98

    Date/Time Formatting


    I really do not want to have to do dateparts for all my forms and queries. Is there a way to store in a table the date/time but place something below that does datepart(four digit year)?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    What do you mean by 'something below'?

    You could use a Calculated field in table: Year([datefield])
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    You can format it anyway you want. yy if needed.

  4. #4
    cuddles is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    98
    In table design where there is the format, input mask, caption, default value, etc.............I want to just have the years 2013, 2014, 2015, etc. I do not want the entire data to be displayed in the table or on any forms. So, I want to do date and time for data type but where would I put this year([datefield])

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    My expression is for use in a Calculated field type.

    The Calculated field type was introduced with Access 2010.

    If you want to have full date value saved into table then need a date/time field for that. Then if you want to show only parts of that saved date, use calculations to extract. The extraction can be done in query or in textboxes or in a table Calculated field. Create a new field in table, select Calculated as field type and a wizard pops up. Access Help has more guidelines.

    If you don't want to even save a full date value and only offer users years as choices, then create a number type field and set it for Combobox. Build the combobox RowSource from a table that has a record for each year or build a Value List. Access Help has more guidelines.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    cuddles is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    98
    That did it. Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Subtracting a date/time field from a number to get date/time
    By Lifeseeker1019 in forum Programming
    Replies: 4
    Last Post: 03-28-2014, 12:59 PM
  2. Replies: 1
    Last Post: 03-13-2014, 07:23 PM
  3. Replies: 4
    Last Post: 03-06-2013, 02:32 PM
  4. Date and time formatting when pulling from a form field
    By avarusbrightfyre in forum Programming
    Replies: 3
    Last Post: 09-15-2011, 04:20 PM
  5. Date and Time Formatting
    By reidn in forum Access
    Replies: 8
    Last Post: 07-22-2011, 10:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums