Results 1 to 4 of 4
  1. #1
    johnrohan is offline Novice
    Windows 10 Access 2007
    Join Date
    Aug 2017
    Posts
    15

    How to change date format inside a text field?

    Here is my issue. I have a text field in my table called "fiscal year", which, not surprisingly, is the fiscal year (in the US starts on Oct 1st).



    So I calculate it with this expression as the default value:

    =IIf(Month(Date())<10,Year(Date()),Year(Date())+1)


    This works fine, except it displays the year as "2017". Is there any way to get the year to display as "17" only?

    If I put yy in the format value, nothing happens. I guess that only works in date/time fields. But if I change this to a date/time field, then it won't understand the expression I use to calculate the fiscal year. I've tried using the format command inside that expression, with no success, and not sure if that is possible anyway.

    Does anyone have any ideas on a way to format this or a work around?

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    try

    =right(IIf(Month(Date())<10,Year(Date()),Year(Date ())+1),2)

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you tried Mid(YourString,2)
    I might have that syntax wrong.

  4. #4
    johnrohan is offline Novice
    Windows 10 Access 2007
    Join Date
    Aug 2017
    Posts
    15
    Quote Originally Posted by Ajax View Post
    try

    =right(IIf(Month(Date())<10,Year(Date()),Year(Date ())+1),2)

    Thank you! simple solution and it works. It doesn't work on previous entries, but it applies it to all new ones. I can work with that.

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

Similar Threads

  1. Replies: 7
    Last Post: 04-07-2017, 02:08 AM
  2. field format change date to text
    By Jen0dorf in forum Access
    Replies: 1
    Last Post: 09-02-2016, 12:57 PM
  3. If date field in text format
    By adnancanada in forum SQL Server
    Replies: 3
    Last Post: 08-02-2016, 01:44 PM
  4. Replies: 6
    Last Post: 06-26-2015, 08:55 PM
  5. Replies: 1
    Last Post: 08-07-2011, 07:58 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