Vbscript Date In Past - Message Not Possible Follow

0
Avatar
Legacy Poster

Hi all,

We have got several label designs where the print operatives needs to enter a sell by date before they submit the print job.
This sell by date always needs to be in the future (logical)

However, we had a problem that somehow one of the print operatives has entered a date that was in the past.

I want to know if it is possible to create a VBscript so when a date is entered which is in the past, a message appears that the entered date is not possible.

Does someone know how to do this ? If there are any other solutions I would be most gratefull to hear that.
We are using BarTender Professional 9.4

Thanks,

Erik

5 comments

0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

Hi Erik,
You can do custom validation in More Options > VB Script > OnProcessData Event.
When input value doesn't match with condition, you can use CancelPrinting function to correct.

ex.
[code]
If not isDate(Value) Then
Format.CancelPrinting("Date Format incorrect.")
Else
If CDate(Value) < Date Then
Format.CancelPrinting("Input date was in past.")
End If
End If
[/code]

[attachment=39:ErrorIfPastDateInput.zip]

Hope it helps!
0
Avatar
Legacy Poster
Comment actions Permalink

Hi Shotaru,

Thanks for your reply!
This works for now, but I think we are going to fase a problem when we reach the end year.

On our labels, the date format needs to be entered as "DD MMM" so for example 17 OCT
When we are near the end year, and they have to enter a date which is in Januari it also says that the date is in the past.

Any idea how we can sort this out by VB Script or do we also have to enter a year which will not be printed on the label.

Thanks in advance,

Erik
0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

Hi Erik,
I don't have a beautiful answer as it's not possible to determine past date without input year. (You can assume some condition, though.)

To strip year from input, use a hidden text.
Create a text (say"Text 1") above of label, then enable user prompt, set onProcessData VB Script above.
Create another text("Text 2") on label, select datasource as [Label object string] of "Text 1".
In more options > Truncate, leave 6 characters from left.

so result will be
Text 1: "18 OCT 2011"
Text 2: "18 OCT"
0
Avatar
Legacy Poster
Comment actions Permalink

[quote name='Shotaro I -Seagull Support' timestamp='1318905955' post='833']
Hi Erik,
I don't have a beautiful answer as it's not possible to determine past date without input year. (You can assume some condition, though.)

To strip year from input, use a hidden text.
Create a text (say"Text 1") above of label, then enable user prompt, set onProcessData VB Script above.
Create another text("Text 2") on label, select datasource as [Label object string] of "Text 1".
In more options > Truncate, leave 6 characters from left.

so result will be
Text 1: "18 OCT 2011"
Text 2: "18 OCT"
[/quote]

Hi Shotaru,

Once again, thanks for your reply!

I have managed to get this working on my PC, however I am using the trial Enterprise version.
Somethings says me that the function "Label Object String" is not possible in the Professional edition.

Am I right ?

We have about 6 versions of BarTender Professional running troughout the company.

Thanks in advance,

Erik
0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

Hi Erik,
Label Object String is Available from Professional Edition or above, and that's introduced from somewhere around BarTender 7.7.
So the solution works if you have recent version of BarTender Professional.
If you use BarTender 6, (truly thanks if so) then it's a good chance to upgrade to the latest version.

Please sign in to leave a comment.