Function GetAltAccountNo(DatabaseObject, DebtorID, AltAccountNo, rtnErrorModule, rtnErrorString)
GetAltAccountNo= True
With DatabaseObject
rHwnd = .StatementOpen(.ConnectionJiwaRead1, , , 1)
If GetAltAccountNo= True Then
SQL = "SELECT TOP 1 AltAccountNo " _
& "FROM DB_Main " _
& "WHERE " _
& "DebtorID = " & .FormatChar(DebtorID)
If .ExecuteSelect(CInt(rHwnd), SQL, True) = True Then
If .FetchRow(CInt(rHwnd)) = True Then
AltAccountNo= .GetData(CInt(rHwnd), 1)
Else
rtnErrorModule = "GetAltAccountNo"
rtnErrorString = "Inventory item with DebtorID of '" & DebtorID & "' not found."
GetInventoryWeight = False
End If
Else
rtnErrorModule = "Database.ExecuteSelect"
rtnErrorString = .ErrorMessage
GetAltAccountNo= False
End If
.StatementClose CInt(rHwnd)
End If
End With
End Function
If GetAltAccountNo(SalesOrderObject.Database, SalesOrderObject.DebtorID, altAccountNo, errorModule, errorMessage) = False Then
MsgBox errorModule& vbCrLf & errorMessage
Else
MsgBox altAccountNo
End If
Return to Technical / Programming
Users browsing this forum: No registered users and 2 guests