Forum Discussion

J0hn60rt0nmentions's avatar
J0hn60rt0nmentions
Copper Contributor
May 25, 2020

Default field in a table

In my database I a table with a field have a field called "Year" and at the moment this is set to a default for the current year i.e. 2019 and I have to change it each year.  Can this field be updated automatically so that next year this field will be amended to 2021 and so on through the years to come. 

5 Replies

  • J0hn60rt0nmentions Instead of hard-coding a value, use the relevant Date function, which is Year(). Since you want to use the following year, not the current year, you'd use Year(Date())+1

    • J0hn60rt0nmentions's avatar
      J0hn60rt0nmentions
      Copper Contributor

      Hi George,  Many thanks for the help and it works,  That's great ....... Super ...... 

       

      John

    • J0hn60rt0nmentions's avatar
      J0hn60rt0nmentions
      Copper Contributor

      George Hepworth  Hi George,  many thanks for the message.  I have tried it it I get a error message say "Expression entered has a function containing the wrong number of arguments" I have tried it in most of the relevant formats  Number, Date/Time/and Short text. Any ideas please. What I thought would happen would be, as the database went over in to the next year the year will be auto updated which is what happens in the Date() function.

Resources