VBScript Unabled to get field values from excel using built-in codes
Hi all,
I'm trying to use a VBScript Data Souce to access Excel's Field value.
While the Excel is actually populated, the Field() always returned empty, why?
I even did not modify the code by a bit, even simple
Value = Field("ProductDBA.Sheet1.productDesignator")
would not work.
upon testing it returns
"12345678"
, which is suggesting that the field value is not found and returning the defaultstring.
I tried to re-setup the db connection but that did not work either.
-
Peter Thane
★ BarTender Hero ★
Try editing the VB script for the field so that it is an Event Controlled Script set to OnNewRecord as this will force the VB to use the data taken from the database at print time when a new database record is selected
0 -
Travis Su
★ BarTender Hero ★
Peter Thane,
Is it possible to iterate the connected db record to match specific one with the value?
My approach is there will be a textbox accepting the value by barcode scanner, which will be a customized serial number consisting product code which in.
Example: SG0711AB11E000001, where 0711A is the product code.
I wanted to use VBscript to substring the '0711A' out (hence the Mid() code above) and iterate the db finding the matching row, then output other data in that row.
is it possible? That way I don't have to select the record in order to retrieve the value
0 -
Peter Thane
★ BarTender Hero ★
Okay, if you are needing to strip out part of the input to use the rest for the lookup then you can use the More Options via the Filter/Database Query Prompt setup
0 -
Travis Su
★ BarTender Hero ★
Peter Thane
Peter,
Just tried the character filter. I don't know how to filter out the characters before the target character I.e. SG
But while the prompt worked in some way, I've managed to tie it to the database and print stuff. But I could not able to print the rest of the Serial Number.
Of course, I can tie the query prompt entry value to the Serial Number field, but If the filter is in place, it would not be a complete Serial Number. If used it without the filter, a complete Serial Number entry would not be able to find a matching row because it uses the complete serial number to search against the database which of course will return nothing. Or maybe I'm using it the wrong way?
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
4 commentaires