Skip to main content

Search

Search

VB Type Mismatch Error

Comments

18 comments

  • Avatar
    Peter Thane

    Have you tried adding an Int command to each of the lines?

    ie  v1 = Int(Format.Objects("BW").Value v2 )  

     

    0
  • Avatar
    Jenna Pearce

    Hi Peter,

    I did try this initially but the problem is that the values I'm calculating are weights and I need to display them to 2 decimal places unfortunatley!

    Thanks,

    Jenna

    0
  • Avatar
    Peter Thane

    If you make sure the fields have some numeric default values and remove the DIM line then it should work as it is

    0
  • Avatar
    Jenna Pearce

    Hi Peter,

    No luck unfortunately :(

    0
  • Avatar
    Peter Thane

    You need to use Format.NamedSubstring not Format.Objects for the v1 command

    0
  • Avatar
    Jenna Pearce

    I can't pull the value from the embedded table if I use NamedSubstring, the only way I can get the value to pull through is to use Format.Objects. I have already tried this with Format.NamedSubstring for everything.

    0
  • Avatar
    Peter Thane

    Is it a Database field too and so could you reference it from their instead? If not what type of field is it on the label?

     

    0
  • Avatar
    Jenna Pearce

    I have two types of fields on the label. The two items shown as a NamedSubstring are database fields, from a linked SQL database. There is then a linked database pulling data from an Excel spreadsheet, generating the BW field via a table. The only way I seem to be able to extract the value from this table using VB is with the Format.Objects coding.

    0
  • Avatar
    Peter Thane

    Not tried doing what you are doing but you try and add an additional text field onto the label and link that the to the BW field (say via the Object Print Method) and then, having named the field, link to that in the VB with the Format.Named

    Not a table object but for a text item using Format.Objects, to perform the maths functions I had to either convert it to an Integer (Int command), which I know you cant use or else add a Round command in for that object first, as shown below

     

    0
  • Avatar
    Jenna Pearce

    That seems to have helped a bit but not fully solved it! I now don't get an error in the VB script editor and when I test the script it doesn't show any errors. However when I go to print a label it still gives the same error:

     

    0
  • Avatar
    Peter Thane

    Does the data in the database include the weight symbol? ie 10.5 KG etc

    The error is saying the data in the database is not numeric and so cannot process it. You configure the Truncation>Character Filter>Numeric Only for field 28 then that should get round this but this may mean you need to add another string (or substring) that has the weight symbol in it

     

    0
  • Avatar
    Jenna Pearce

    Hi Peter,

    Unfortunately not!

    The weight from the table is shown below. I've also tried with the Box Weight field in red which is a separate field, taking the same data as from the table.

    0
  • Avatar
    Peter Thane

    Are you still using the format.object route? As I wonder if this is still the issue. Or when are you processing the VB? You may need to set as an Event Controlled VB routine, possibly OnNewRecord or OnPostPrompt so that it runs using the data pulled from the tables.

     

    0
  • Avatar
    Jenna Pearce

    Hi Peter,

    Yes still using format.object.

    It's OnPostPrompt at the moment.

    Would it be too cheeky of me to suggest if you have time we could perhaps have a Teams call? I really appreciate your help and support and wonder if it might be easier if we can share the screen live!

    Jenna

    0
  • Avatar
    Peter Thane

    Sorry, been away and just checking this would be okay with the guys at Seagull.

     

    0
  • Avatar
    Xabier Clemente
    Moderator

    Hey all! Our Forum's policies don't permit us to share personal information here. However, if Jenna is OK with it, we could send her Peter's personal information via email. :)

    0
  • Avatar
    Jenna Pearce

    Hi both, that would be amazing if you could!

    0
  • Avatar
    Xabier Clemente
    Moderator

    You should have Peter's details in your inbox. If not, please let me know :)

    0

Please sign in to leave a comment.