Hello all,
I am trying to add vendor bank details to the remittance advice report, however i keep getting an error when i enter the following code within the onaftergetrecord of the Vendor Ledger Entry data item
Vend: Vendor table
VendBankAcc: Vendoor bank account table
IF Vend."BACS Account No." <>'' THEN BEGIN
VendBankAcc.GET("Vendor No.",Code) THEN BEGIN
BankSC := VendBankAcc."Bank Branch No.";
BankAcc := VendBankAcc."Bank Account No.";
END;
Can anyone help please?
Answers
IF Vend."BACS Account No." <>'' THEN BEGIN
IF VendBankAcc.GET("Vendor No.",Code) THEN BEGIN
BankSC := VendBankAcc."Bank Branch No.";
BankAcc := VendBankAcc."Bank Account No.";
END;
END;
IF Vend."BACS Account No." <>'' THEN BEGIN
VendBankAcc.GET("Vendor No.",Code);
BankSC := VendBankAcc."Bank Branch No.";
BankAcc := VendBankAcc."Bank Account No.";
END;
Code is not a field specified in the table Vendor Ledger Entry. Where do you set it?
VendBankAcc.GET("Vendor No.",Code);
1st, GET operates on a record's primary key, and assuming VendBankAcc is a "Bank Account" the key is "No.". If Code is a var that contains a bank acocunt No., then the line to get the bank account record would be:
VendBankAcc.GET(Code);
Wrap that in an IF/THEN to cach any error that may occur.
(Others jump in if I'm wrong here.)
OK := TableRecord.GET("key 1 value","key 2 value");
IF TableRecord.GET("key 1 value","key 2 value") THEN BEGIN
// do some processing
END;
And it doesn't make sense to get a Bank Account out of a Vendor Ledger Entry. So I assume he doesn't understand the business logic of that part of NAV.
I have also tried this:
Vend.GET("Vendor No.");
IF Vend."BACS Account No." <>'' THEN BEGIN
VendBankAcc.GET(Vend."No.",Vend."BACS Account No.");
BankSC := VendBankAcc."Bank Branch No.";
BankAcc := VendBankAcc."Bank Account No.";
END;
Could you post your error message?