Skip to main content

Search

Search

Two Different Data Formats From One Linked Field

Comments

5 comments

  • Avatar
    Ian Cummings
    Moderator

    In one of the items use a VB Script to refer to the named data source in the other.  The VB script can then be set to format the date value as needed.

    0
  • Avatar
    vicki wordsworth

    hoping someone can explain this further... i have no idea how VB script works.

    I have a date field on my label in the format of MMM YY and the barcode date needs to be yymmdd.

    what do you mean by refer to the named data source in the other. and how do i set the format in the VB script.  

    thanks

    0
  • Avatar
    Peter Thane

    Hi Vicki,

    I am assuming the date maybe database connections of Data Entry forms in use in the information below

     

    • Go into the Properties of your barcode and select the yyMMdd substring. 
    • In the Data Source tab on the right hand side click on the Change Data Source Name button and on the new screen give the field a name (with no gaps in it) such as thisdate
    • Click Ok and Close to come out of the barcode and then go into the Properties of your Text field
    • Change the Type to Visual Basic Script and Event Controlled Script and the press the Edit with Script Editor button
    • A new screen will appear and in the new big box in the middle delete what is there and type Value = "Oct 2018" to give the field a dummy value
    • In the column on the left select the 4th option down to the one highlighted, namely OnPostPrompt and the box in the middle will change to a blank box
    • In that box type Value = 
    • Now in the column on the right double click on the name of the field you set above and so the box in the middle should now change to something like

    Value = Format.NamedSubStrings("thisdate").Value

    • press Enter to start a new line and then copy and paste the following lines of code into the box

    Value1 = Left(Value,2)

    Value2 = Left(Value,4)

    Value2 = Right(Value2,2)

    Value2 = MonthName(Value2,True)

    Value = Value2&Value1

    • If you want a space between the Oct and the 18 then amend the last line to

    Value = Value2&" "&Value1

    • If you need the month to be in upper case (OCT not Oct) then add the following line before the last Value= line

    Value2 = UCase(Value2)

    • When complete click Close and OK and test as required

    Pete

     

    0
  • Avatar
    vicki wordsworth

    Thanks Pete

    Unfortunately i still can't get this to work.

     

    any other ideas?  thanks again  is there a way i can show you my file by any chance?

    Vicki

    0
  • Avatar
    Peter Thane

    Hi Vicki,

    You could email me a copy of your label and some detailed notes about what you are trying to achieve and i can take a look.

    Pete

     

    info (at) dcatonline.co.uk

    0

Please sign in to leave a comment.