Zum Hauptinhalt gehen

Suche

Suche

Vb Scripting With Dates

Kommentare

7 Kommentare

  • Avatar
    Michael Toupin (mtoupin
    [quote name='tambrosi' timestamp='1352833213' post='3697']
    I have an issue with Bartender that I do not know how to get around,
    I have a string date in the format of "06/22/2012" and I need to add 740 days to it.

    I used this command to try and change it,
    MyShortDate = CDateField("BarTag.Field 30")

    and I get a type mismatch error,

    Any help would be greatly appreciated
    Thanks
    Terry
    [/quote]

    You'll want to do something like this:

    value = cDate("BarTag.Field 30") + 740

    This will get the string to be used as a date, then add the appropriate number of days.
    0
  • Avatar
    Legacy Poster
    [quote name='Mike T - Seagull Support' timestamp='1352850975' post='3701']
    You'll want to do something like this:

    value = cDate("BarTag.Field 30") + 740

    This will get the string to be used as a date, then add the appropriate number of days.
    [/quote]
    0
  • Avatar
    Legacy Poster
    This it the error I have been dealing with-- Please

    value1 = Mid(Field("BarTag.Field 30"),1,2)
    value2 = Mid(Field("BarTag.Field 30"),4,2)
    value3 = Mid(Field("BarTag.Field 30"),9,2)

    value = cDate("BarTag.Field 30") + 740

    msgbox value1
    msgbox value2
    msgbox value3

    strLotNumber = "12062201"
    dteDate = CDate(Mid(strLotNumber, 5, 2) & "-" & MonthName(Mid(strLotNumber, 3, 2), True) & "-" & Left(strLotNumber, 2))
    dteBestBy = DateAdd("m",1, dteDate)
    strBestBy = Right("0" & Month(dteBestBy), 2) & "/" & Right("0" & Day(dteBestBy), 2) & "/" & Right(Year(dteBestBy), 2)
    'MsgBox strBestBy
    value= strBestBy


    value = cDate("BarTag.Field 30") + 740
    Error Type mismatch cdate.

    date input comes as "06/22/2012". This is from other software, so I do not have control over the format.
    Thanks
    Terry
    0
  • Avatar
    Michael Toupin (mtoupin
    [quote name='tambrosi' timestamp='1352900613' post='3714']
    This it the error I have been dealing with-- Please
    See attachment

    value = cDate("BarTag.Field 30") + 740
    Error Type mismatch cdate.

    date input comes as "06/22/2012". This is from other software, so I do not have control over the format.
    Thanks
    Terry
    [/quote]

    Terry,

    Is this when you print, or just when you try to process the code?

    Remember that it won't read anything but the default value until print time, so a type mismatch if you're just writing the code isn't a surprise. Make sure that if you're reading from a label object that it's got the default value is in the format that you're using.
    0
  • Avatar
    Legacy Poster
    Mike, thanks for getting back to me.

    If I send you the .dat file and the btw file can you take look see at it. I get the error when writing the code and cannot save the script. So it never executes at print time.

    Thanks
    Terry
    0
  • Avatar
    Legacy Poster
    Please see attached file on what I see.
    I also enclosed the btw file.
    Any help would be greatly appreciated. If the script could be resolved at run time
    that would be great.
    Part of the .dat file
    82294,"TEST3","06/22/2012","Wells Enterprises Inc","894751 \ GV 48OZ HOME VANILLA","
    Thanks
    Terry
    0
  • Avatar
    Legacy Poster
    Mike T.

    Thanks for the help, But I just might have this working. I am going to be running in a production setting and that should let me know if it is working.

    Thanks
    0

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