Dear All,
When doing a General or Purchase journal, I have an extension whereby when I select "Account No." field, the GL account attached to respective posting group i.e. vendor posting group needs to be retrieved and its balance read. My issue is when I select the Account Type i.e. vendor, I get an error below before I select the vendor account. But if the Vendor account type is default in my journal line, I don't get error ,I am allowed to select the vendor account and my code works as expected. I need the liberty to select the account type of my choice i.e. vendor, employee etc with no error so I can the vendor of my choice or employee without this error. I don't understand why this error is coming if I haven't selected the vendor or employee himself.

Code extract
begin
If "Account Type" = "Account Type"::Vendor then
begin
If Vend.Get(Rec."Account No.") then
If VendAccPostGrp.Get(Vend."Vendor Posting Group") then
Message(VendAccPostGrp."Payables Account");
GLAcc.Get(VendAccPostGrp."Payables Account");
GLAcc.SETRANGE("Date Filter",0D,TODAY);
GLAcc.CalcFields(Balance);
End
end