I have included the following vb script to the Distribution Account on a receivable transaction integration. It is failing with the error "DOC 1 ERROR: Source Field Source1.F5' not found in object."
This is the correct Source name and the correct Source column (doesn't have headers). Can I reference another source even when the Record Source under options for the Distributions is set to Source2?
'This script is intended to:
' 1. Read the default GL A/R account associated with the customer
' 2. Use A/R account for distribution type 3 and source for other types.
sDataSourceName="GreatPlains"
sLogin="user"
sPassword="password"
sDatabaseName="DB"
sCustomerARFieldName="RMARACC"
sCustomerID=SourceFields("Source1.F5")
'Open a connection to the SQL database
Set pConnection = CreateObject("ADODB.Connection")
Call pConnection.Open(sDataSourceName, sLogin, sPassword)
'Create a new recordset -- that will hold returned data
Set pRecordset = CreateObject("ADODB.Recordset")
'Create a SQL SELECT statement to retrieve the customer's default
'AR account number
sSQL = "SELECT Rtrim(ACTNUMST) 'ARAccount'"
sSQL = sSQL & " FROM " & sDatabaseName & ".dbo.RM00101, "
sSQL = sSQL & sDatabaseName & ".dbo.GL00500 WHERE "
sSQL = sSQL & "RM00101.CUSTNMBR= '" & sCustomerID & "'"
sSQL = sSQL & " AND RM00101." & sCustomerARFieldName
sSQL = sSQL & "=GL00105.ACTINDX"
Call pRecordset.Open(sSQL, pConnection, 3, 1)
sARAccount=pRecordset("ARAccount")
Call pRecordset.Close
Call pRecordset.Open(sSQL, pConnection, 3, 1)
sARAccount=pRecordset("ARAccount")
Call pRecordset.Close
If SourceFields("Source2.F4")=3 THEN
CurrentField=ARAccount
Else CurrentField=("Source2.F3")
End If
This is the correct Source name and the correct Source column (doesn't have headers). Can I reference another source even when the Record Source under options for the Distributions is set to Source2?
'This script is intended to:
' 1. Read the default GL A/R account associated with the customer
' 2. Use A/R account for distribution type 3 and source for other types.
sDataSourceName="GreatPlains"
sLogin="user"
sPassword="password"
sDatabaseName="DB"
sCustomerARFieldName="RMARACC"
sCustomerID=SourceFields("Source1.F5")
'Open a connection to the SQL database
Set pConnection = CreateObject("ADODB.Connection")
Call pConnection.Open(sDataSourceName, sLogin, sPassword)
'Create a new recordset -- that will hold returned data
Set pRecordset = CreateObject("ADODB.Recordset")
'Create a SQL SELECT statement to retrieve the customer's default
'AR account number
sSQL = "SELECT Rtrim(ACTNUMST) 'ARAccount'"
sSQL = sSQL & " FROM " & sDatabaseName & ".dbo.RM00101, "
sSQL = sSQL & sDatabaseName & ".dbo.GL00500 WHERE "
sSQL = sSQL & "RM00101.CUSTNMBR= '" & sCustomerID & "'"
sSQL = sSQL & " AND RM00101." & sCustomerARFieldName
sSQL = sSQL & "=GL00105.ACTINDX"
Call pRecordset.Open(sSQL, pConnection, 3, 1)
sARAccount=pRecordset("ARAccount")
Call pRecordset.Close
Call pRecordset.Open(sSQL, pConnection, 3, 1)
sARAccount=pRecordset("ARAccount")
Call pRecordset.Close
If SourceFields("Source2.F4")=3 THEN
CurrentField=ARAccount
Else CurrentField=("Source2.F3")
End If