Saltar al contenido principal

Búsqueda

Búsqueda

Vb Script Assigned To Data Entry Form Events

Comentarios

10 comentarios

  • Avatar
    Legacy Poster

    So, I'm not sure 100% of what you want can be done, but we can try...

     

    Basically everything on the data entry form is linked to a data source on your label format. Such as a checkbox may link back to a data source that says "Yes", or "No". If you use VBScript to change this data source from "No" to "Yes", for example, that should reflect on the data entry form when it pops up.

     

    Note, that if it helps, this field does not have to be within the printable area of the label, it can be a field set off to the side that just says "Yes" or "No" if that helps...

    0
  • Avatar
    Legacy Poster

    This is very interesting. I didn't consider using the outside of the printable area to hold data. 

     

    How I will attempt to make this work is as follows for anyone else that may be looking for the same resolution. When I get it working, I will repost and confirm/change what I found.

     

    -Create data field outside printable area

    -Associate the data field with the check box

    -Code the applicable fields with a IF statement to check what text is returned from the check box data field

    -Input information for applicable fields and print data

     

    Possible Issues:

    -Data entered is overwritten by coded data

    -Unable to hide/disable text box fields for data entry

    -Confusion of user during process

     

     

    I will tackle this over the next few days and respond with what I came up with.

    Thank you nRyder

    0
  • Avatar
    Legacy Poster

    Okay, in my first dabbles into making this work I am trying to write an expression that will pull the entered quantity, convert it into an integer, multiply that integer by 3.03, then return it as Value. This returns an error that I have not seen as I have not converted values in bartender until now, and have only been using bartender for a month to date. I am familiar with Visual Basic, but not to much its VBScript little sister.

    Here is the code snip that is returning the error.

    Dim intQuantity
    Dim intNet

    intQuantity = CInt(txtQuantityCalc)

    intNet = intQuantity * 3.03

    Value = CStr(intNet)


    EDIT: The error that is returned is "<Line 9: : Type mismatch: 'CInt'>"

    0
  • Avatar
    Legacy Poster

    Where is the value for txtQuantityCalc coming from? Is this a data source in your BarTender format?

    I think the conversions are unnecessary, as BarTender's VBscript should treat the value as a number automatically if that's what it is given.

    0
  • Avatar
    Legacy Poster

    txtQuantityCalc is a text input box on the data entry page. When someone enters a number of parts, the calculation would then fill in the estimated weight and number of boxes.

     

    I will try it with no conversions and let you know what I get.

    0
  • Avatar
    Legacy Poster

    That would be a negative.

     

    The error that was returned was the same, just string instead of int. <Line 9: : Type mismatch: '[string: ""]'>

     


    If isChecked = "True" Then
        Value = "300"
    Else
        Value = txtQuantityCalc * .35
    End If

     

     

    The "isChecked" value is a text field outside of the label that changes if the check box is or is not checked.

    txtQuantityCalc is still the text box for input on the data entry form.

     

    EDIT:

    I also tried this scripting,

     

    If isChecked = "True" Then
        Value = "300"
    Else
        Value = CStr(txtQuantityCalc * .35)
    End If
    0
  • Avatar
    Legacy Poster

    Could you attach the .btw and point to the error field? I could take a quick look...

    0
  • Avatar
    Legacy Poster

    Here is a link to download the file.

     

    http://1drv.ms/1u93anz

     

    The error is in the Net Weight Field

    0
  • Avatar
    Legacy Poster

    The problem is that txtQuantityCalc has no assigned value if isChecked <> "True". Therefore the script is trying to convert a Null to an integer.

     

    If I change your txtQuantityCalc script to the following:

     

     

    If isChecked = "True" Then
        Value = "864"
    else
        Value = "0"
    End If
     

    I no longer have a Nt Wgt script error.

     

    Edit: I see that you want the user to be able to enter a value and not have it overwritten by this script. Therefore, I put another field off the label called "UserQuantity" and linked your user prompt field to that. Then the above script becomes

     

     

    If isChecked = "True" Then
        Value = "864"
    else
        Value = UserQuantity
    End If
     

     

    0
  • Avatar
    Legacy Poster

    This solved my problem, thank you nRyder.

    0

Iniciar sesión para dejar un comentario.