Zum Hauptinhalt gehen

Suche

Suche

VBScript help Custom Date variable

Kommentare

3 Kommentare

  • Avatar
    Peter Thane

    Sorry very rusty on VB and so all my stuff is quite rusty and basic and I have never trued an While and Wend statement. I suppose I could have use a dim statement for the day of the week adjustment but this is what I have used. 

    The first line is referencing a Named Data Source on my label called DateChosen and I had linked this to a Data Picker on a Data Entry Form so I could test it. I used a VB Event Controlled Script > OnIdenticalCopies option to add in the VB routine.

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

    Value1 = Weekday(Value)

    If Value1 = 0 then
    Value = DateAdd("d",-5,Value)

    elseif Value1 = 1 then
    Value = DateAdd("d",-6,Value)

    elseif Value1 = 2 then
    Value = Value

    elseif Value1 = 3 then
    Value = DateAdd("d",-1,Value)

    elseif Value1 = 4 then
    Value = DateAdd("d",-2,Value)

    elseif Value1 = 5 then
    Value = DateAdd("d",-3,Value)

    elseif Value1 = 6 then
    Value = DateAdd("d",-4,Value)

    elseif Value1 = 7 then
    Value = DateAdd("d",-5,Value)

    end if

    Value = DateAdd("M",10,Value)

     

    0
  • Avatar
    Oly S

    Hello 

    maybe want to give it a try... 

    regards

    Oly

    rem get current day of week, based on monday is 1st day of the week
    dayofweek = DatePart("w", Date, 2)

    rem get moday's date
    monday=DateAdd("d", 1-dayofweek, Date)

    rem add 10 month
    monday=DateAdd("m", 10, Date)

    value=monday



     

    0
  • Avatar
    Zach Taylor

    I will be trying both of these this week. I'm fairly new to how BarTender does the vbscript but will use these to see what I get will keep in touch.

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.