Help With If Then Else Follow

0
Avatar
Legacy Poster

I am new to vbScripting in BarTender and need help with following. I am trying to do something which should be relatively easy, I want he Qty in a box to appear except on last label I want Qty in last box to appear.

 

I have a basic label getting a few fields from a SQL view. I have added 5 shared DataSources to this label.

SharedDataSource1 = QtyInBox

SharedDataSource2=QtyInLastBox

SharedDataSource3=RecordNo - this is a Type = Print Job Field and Field = Page Number

SharedDataSource4=TotalNoOfLabels - This is a Type = Print Job Field and Field = Total Number of Pages

 

I also have a print dialog Data Source = Copies

 

Therefore when a user prints a label he is asked to enter number of labels (Copies), QtyInBox, QtyInLastBox.

 

I then have a SharedDataSource5 with a multi line vbScript as follows

 

If Format.NamedSubStrings("RecordNo").Value >= Format.NamedSubStrings("TotalNoOfLabels").Value  Then
 
    Format.NamedSubStrings("QtyInLastBox").Value
 
Else
 
    Format.NamedSubStrings("QtyInBox").Value
 
End If 
 
But I keep getting error 6900
 
Any help will be appreciated.
 
Prak

 

3 comments

0
Avatar
Legacy Poster
Comment actions Permalink

When you are assigning the value of the Data Source in question, you need to put "Value = ".

 

So inside your If statement should be:

 

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

or

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

0
Avatar
Legacy Poster
Comment actions Permalink

Thanks Guru

 

Changed my statement as suggested 

 

If Format.NamedSubStrings("RecordNo").Value >= Format.NamedSubStrings("TotalNoOfLabels").Value  Then
    Value = Format.NamedSubStrings("QtyInLastBox").Value
Else
    Value = Format.NamedSubStrings("QtyInBox").Value
End If 
 
But still get the same 6900 error
0
Avatar
Legacy Poster
Comment actions Permalink

Is there any more information on the error screen than that? I do not have an issue with that code - can you attach the .btw file to a post?

Please sign in to leave a comment.