Results 1 to 5 of 5
  1. #1
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486

    default value of yyyy.mm

    I am trying to create a default value in a field. The field is a combo box that pulls all the values from a lookup table I created. The table has values for year and month listed as yyyy.mm , so 2015.11 and then 2015.12



    I have an unbound box on the form and have used the following formula =Cdbl(YEAR(TODAY())&"."&MONTH(TODAY()))

    However, it says #name and does not show 2015.11 as the default value

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try the Date() function instead of Today().
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486
    Yes, that fixed it, thanks

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    One problem with that expression. November (2015.11) will sort before February (2015.2). Need placeholder 0, like: 2015.02

    Format(Date(),"yyyy.mm")

    This will also eliminate the concatenation.

    Probably should fix values in the lookup table. An alternative to the lookup table is to build the combobox list from data records.
    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.

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

Similar Threads

  1. Replies: 3
    Last Post: 01-03-2014, 03:14 AM
  2. Can access format a date in an odd way? DD-MMM-YYYY
    By redbull in forum Programming
    Replies: 3
    Last Post: 08-23-2013, 11:34 AM
  3. Conditionally formatting a mm/dd/yyyy*
    By Steve3415 in forum Reports
    Replies: 4
    Last Post: 03-11-2012, 02:36 PM
  4. InputMask yyyy-mm for Label
    By smaky in forum Queries
    Replies: 5
    Last Post: 11-03-2010, 10:20 AM
  5. Convert to MMM/YYYY
    By Brian62 in forum Queries
    Replies: 10
    Last Post: 08-31-2009, 04:54 PM

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