automatic combo box selection on opening form

Dear all, I have a form where on opening it, automatically combo box selection to be selected as check . I was trying in Active method as below where some fields gets disabled. but here Paymmode combo box to be taken as check on opening the form. Please let me know a solution for the same.

If(ledgerjournaltable.JournalName ==“APPayCheck”)
{
ledgerJournalTrans_ds.object(fieldnum(LedgerJournalTrans, PaymentStatus)).allowEdit(true);
buttonPaymReconciliation.enabled(true);
ledgerJournalTrans_ds.object(fieldnum(LedgerJournalTrans,Paymmode)).allowEdit(true);
ledgerJournalTrans_ds.object(fieldnum(LedgerJournalTrans,BankChequeNum)).allowEdit(false);
ledgerJournalTrans_ds.object(fieldnum(LedgerJournalTrans,BankChequeNum)).allowEdit(false);
ledgerJournalTrans_ds.object(fieldnum(LedgerJournalTrans,BankChequeNum)).
}

Thanks…

Sorry, I didn’t get what’s you’re trying to do. Do you want to set the combobox to a particular value? What can you tell us about the comboxbox? Is it linked to a datasource field? It’s is an enum value or a reference to another table?

Yes a field in Accounts Payable → Payment journal → Journal lines → a field from ledgerjournaltrans called paymmode. Its a EDD and it redirects to a form method of payment. So method payments has 2 rows. one is banktrans and other one is check…

When the user opens a journal lines for journal name APPayCheck ,the paymmode should be set to default value as check . If not then should remove the default value. Hope Its clear if not please let me know.

Thanks…

Don’t you actually want to initialize the value every time when a journal line is created, instead of “on opening the form”? You could simply set a value to LedgerJournalTrans.PaymMode in initValue() of the data source.

You’ll find the journal header in ledgerJournalTable variable.

Thanks for the solution but I have written in the active method as paymmode = ‘Check’ . Then it worked.