lookup method for offset account

hi all:

i’ve made a form which includes 2 fields: offset account type and offset account.

the purpose is to choose an offset account from another company than the one you are working in.

i’ve built a method called “lookupOffsetAccount”:

client public static void lookupOffsetAccount(MyTable _MyTable
LedgerJournalACType _ledgerJournalACType,
FormStringControl _formStringControl)

{
CompanyId _companyId;
;
_companyId = _MyTable .DataAreaId2 ; // of the other company
switch (_ledgerJournalACType)
{
case LedgerJournalACType::Bank :
BankAccountTable::lookupBankAccount(_formStringControl, _companyId);
break;

case LedgerJournalACType::Cust :
CustTable::lookupCustomer(_formStringControl, _companyId);
break;

case LedgerJournalACType::Ledger :
LedgerTable::lookupAccountNum(_formStringControl);
break;

case LedgerJournalACType::Project :
ProjTable::lookupProjId(_formStringControl, _MyTable );
break;

case LedgerJournalACType::Vend :
VendTable::lookupVendor(_formStringControl, _companyId);
break;

case LedgerJournalACType::FixedAssets :
AssetTable::lookupAccountNum(_formStringControl, _companyId);

default :

}
}

i made a call to the method in the ds_field’s “lookUp” method:

public void lookup(FormControl _formControl, str _filterStr)
{
;

_MyTable::lookupOffsetAccount(_MyTable,_MyTable.OffsetAccountType,_formControl);

}

the problem is ifi chose “Customer” or “vendor” or “bank” and then try to choose the offset account then i get the infolog :

“The value ‘00004’ in field ‘Offset account’ is not found in relating table ‘Ledger chart of accounts’”

where ‘00004’ is the offset account i’ve chosen.

this offset account exists in the custtable in the othe company.

how can i solve the problem?

thanks :slight_smile: