End of the Month Date
Hi everyone,
I am attempting to set up Bartender file to automatically choose last day of the month (could be 30, 31 or 28 depending on the month) + 6 months, based on entry of another field. For example, if I enter the mfg date manually to be 01/20/2024, I would like Bartender to autofill the expiration date to be 07/31/2024.
I have tried making the Data Source Type for the expiration field to be Visual Basic Script and used the following formula : Value = DateSerial(Year(Date()), Month(Date())+1, 0)
However, I got the error of:
OnAutoSelectedExpression (Line 1): Wrong number of arguments or invalid property assignment: 'Year'
Can someone please help me achieve this?
-
Peter Thane
★ BarTender Hero ★
The simplest way to achieve this, without the need for VB, would be to add a field onto the label (probably off to the side so that it is present but not printed) and set that to a an Object Value Type linked to the other field on the label that has the original date.
The Data Type should be set to Date and the Pattern as just the MM/YYYY (via Custom) with an Offset of 7 months added via the Transforms Tab. If you are using a Data Entry form then you will need to tick the Apply Offset after Data Entry option.
You will then need to add a second Object Value field which is linked to the Object above but this time with the Data Type set to use the required full date pattern with an offset of minus 1 days (Data Entry offset ticked again)
0
Please sign in to leave a comment.
Comments
1 comment