Skip to main content



VB Script Editor CDate


1 comment

  • Avatar
    Peter Thane

    Have you tried adding your database MfgDate onto the label as a text field, then set the Data Type to date and if that works then use the Transforms>Offset and link the offset to the field in the Database that has the months in it?

    So you get something like this (I am using fixed fields rather than Database fields but the theory is the same). Note: if you dont need to actually see this date on the label, just drag the field off to onside so that it can be referenced by other fields later.


    For the VB field to get the Q value you will need to set this as VB Script>Event Controlled Script I would suggest probably OnPostPrompt or OnIdenticalCopies to make sure the VB is processed after the Offset has been applied. 

    I would suggest making the modified date field a Named Data Source (via the button shown below)

    The VB Script I used is as follows

    Value = CDate(Format.NamedSubStrings("TheDate").Value)

    Value1 = Month(Value)

    If Value1 < 4 then

    Value1 = 1

    elseif Value1 < 6 then

    Value1 = 2

    elseif Value1 < 9 then 

    Value1 = 3

    else Value1 = 4

    end if

    Value2 = Year(Value)

    Value2 = Right(Value2,2)

    Value = Value1 & "Q" & Value2


    And for the first line I typed in the Value = CDate( and then double clicked on the Named Data Source from the column on the right to get BarTender to add this link and then added a ) to the end.






Please sign in to leave a comment.