Syntax Issue Follow

0
Avatar
Legacy Poster

We have the professional edition 10.1 SR3, not the automation one, if that matters.

 

I just want a field to print depending on the value of another one.   If Wh=S0 I want the Text7 (not attached to a source, just static text 'NON-STOCK') to show and I want my Barcode1 object to now show.  See the attachment.

 

I used the 'Printer Code Modifier';   I dragged the object Field("tblLabel.WH") from the choices and did that simple test.

 

 

Dim MyVar

If Field("tblLabel.WH") ="S0" Then 
		MyVar=MsgBox("TEST") 

Else 
		MyVar=MsgBox("TEST1")
End If

 

 

 

It keeps giving me error "Mismatch 'Field'".

 

I played with various syntax found on internet, derived from; examples like

 

  • Format.NamedSubStrings("Field1").Value
  • Format.Objects("Text 1").PrintVisibility
  • or simply value="" vs value ="NON-STOCK"

 

I had a look at 

http://www.seagullscientific.com/media/101557/dynamically-changing-objects-at-print-time-using-vb-script.pdf

 

but spent way too much time on this, with only errors... I can't even pass the 1st line; the syntax of this BarTenderMs vbscript seems to be very unique!

 

Thanks for any help 

 

 


 

1 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

The Print Code Modifier (PCM) is the wrong tool to use for this.  In the object/data source that you wish to optionally print or not, use an event VB script with your If..Then statement.  Note that you use the "value = X" expression to set the value of the script's data source.  Set it to something for it to print, and nothing "" if you don't want it to print.

Please sign in to leave a comment.