Script to Synchronize Customer Billing Address in Sales Order Data Entry

SOLVED

I was attempting to create a VB Script (to be executed via an External Link button) that would update the billing address within a sales order from the customer's AR address. Currently our admins do not have the ability to manually change a customer's address - this is only done through accounting.

Consider the following events:

  1. Admin/clerk enters a sales order via S/O Data Entry
  2. Accounting updates the billing address via Customer Maintenance 

The issue then arises that the sales orders that were created prior have the old address information. So I was thinking that it could be possible to create a simple script to update these fields in S/O Data entry, which looks like the following:

oUIObj.SetControlProperty "BILLTONAME", "Text$", SO_SalesOrder_bus_BillToName
oUIObj.SetControlProperty "UDF_BTA", "Text$", ""
oUIObj.SetControlProperty "BILLTOADDRESS1", "Text$", SO_SalesOrder_bus_BillToAddress1
oUIObj.SetControlProperty "BILLTOADDRESS2", "Text$", SO_SalesOrder_bus_BillToAddress2
oUIObj.SetControlProperty "BILLTOADDRESS3", "Text$", SO_SalesOrder_bus_BillToAddress3
oUIObj.SetControlProperty "BILLTOZIPCODE", "Text$", SO_SalesOrder_bus_BillToZipCode
oUIObj.SetControlProperty "BILLTOCITY", "Text$", SO_SalesOrder_bus_BillToCity
oUIObj.SetControlProperty "State", "Text$", SO_SalesOrder_bus_BillToState
oUIObj.SetControlProperty "BILLTOCOUNTRYCODE", "Text$", SO_SalesOrder_bus_BillToCountryCode

Took me a second however to figure out why it wasn't working, and of course it hit me that this is pulling from the same information that it was pulling from to begin with (SO_SalesOrder tables instead of AR_Customer). The issue is that "MS Script Variable Selection" only contains fields from the SO tables and nothing from AR:

Is there an easy way to pass these AR variables to this script without having to create an ODBC connection to the data tables?