Vb Script Assigned To Data Entry Form Events
I am trying to create an intuitive Data Entry Form that will include all part for a single vendor into one label. This is done by having radio buttons for selection and IF statements used to check and verify what vendor and what information needs to be populated.
The issue at hand is the inability (as far as I can see) to apply VB Script to Data Entry Form events such as checking a box or unchecking it. I would like to disable/enable a set of text boxes and apply values to them automatically when these check boxes are checked.
For some shipments, quantity and weight values may change, but will stay the same most of the time. My current solution to the problem is to have a set of labels that define what the default full shipment values should be. This is clunky and can cause quality control issues.
I have messed around with some of the different options for running vbscript on open, or when a print job starts but this does not change any data or objects on the form.
Any input would be appreciated, I would just like to know if this is a functional limitation of the program, or if I am overlooking something.
NOTE: The attached image is a single vendor shipping label to simplify it visually.
I want to have a checkbox option that if clicked, it will disable the text boxes so that no data can be entered. I can take care of the code to fill in the desired values, but I am not aware of a method to code the checkbox event to change Form objects.
-
Legacy Poster
★ BarTender Hero ★
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 -
Legacy Poster
★ BarTender Hero ★
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 -
Legacy Poster
★ BarTender Hero ★
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 -
Legacy Poster
★ BarTender Hero ★
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 -
Legacy Poster
★ BarTender Hero ★
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 -
Legacy Poster
★ BarTender Hero ★
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" ThenValue = "300"ElseValue = txtQuantityCalc * .35End IfThe "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" ThenValue = "300"ElseValue = CStr(txtQuantityCalc * .35)End If0 -
Legacy Poster
★ BarTender Hero ★
Could you attach the .btw and point to the error field? I could take a quick look...
0 -
Legacy Poster
★ BarTender Hero ★
Here is a link to download the file.
The error is in the Net Weight Field
0 -
Legacy Poster
★ BarTender Hero ★
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 -
Legacy Poster
★ BarTender Hero ★
This solved my problem, thank you nRyder.
0
Iniciar sesión para dejar un comentario.
Comentarios
10 comentarios