VBScript - Getting Field Values to Pass to SQL Query for Validation Follow

0
Avatar
Nick Napier

Hello,

I have added VB Script to connect to an SQL table and get the last serial number printed and I need to send the user BarTender form entered value of a different field along with the query in order to get the range to check for duplicates. Reason: This is required as we have roughly 10 different parts and templates that print serial numbers that all must be unique across all parts, not just unique per part.

I have no issues with the VB & SQL, but I’m having trouble working out how I go about accessing the value that the user enters into the printing form.

Example of what I’m attempting to do:

                dim range_field_value

                range_field_value = Fields(‘range_field’)  ‘ Doesn’t work, just returns 123456789

                range_field_value = Format.Objects("quantity_range").Value ‘ Error on operation for this object type

I have an SQL query that will send the range_field_value to a stored procedure and I'll use it to validate. The SQL has been tested and is working, I just need to get the field value.

I’ve reviewed and attempted to use the article entitled “Vb Script Accessing Entered Form Field Value (https://support.seagullscientific.com/hc/en-us/articles/360013127973?input_string=vb+script+-+accessing+entered+form+field+value)”, but I simply get the same “123456789” value.

Is there a specific example or tutorial that you could point me to on how to get the value of a field within VB Script?

Any help would be very much appreciated. Thanks for reading!

2 comments

0
Avatar
Pete Thane
Comment actions Permalink

It sounds like the VB is been processed before there is any data in the field. Have you tried running your VB as an Event Controlled Script (PostPrompt) ? 

Pete

0
Avatar
Nick Napier
Comment actions Permalink

Details on environment being used:

  • Application Version: 2016 R4

  • Build: 3127

  • Edition: Automation

  • OS: Windows 10 Pro x64 build 17134

  • Document Compatible Version: 2016 R1

Please sign in to leave a comment.