To Focus on a Text Box(Control)

I have a form which is editable(Insert Allowed is No, Modifiy Allowed is Yes, Delete Allowed is No). But all the fields of the source table on the form are not editable, but enabled, visible and focusable. The source table is Sales Header table. The field Sales Header.“No.” is not editable because the form is not used for entering sales orders but for entering load details for an existing order. So the user will scan the Sales Order No. from a printed document and as soon as he does this the form should display the header and detail lines. My problem is: I have to click on the Sales Order No. field to bring focus to it. After this I can enter the order no. and it brings up the order. If I make the field editable it complains ‘Record already exists’. How do I tell the form to focus on a particular non-editable field as soon as the form is opened. I tried the following code in the OnOpenForm trigger: CurrForm.“No.”.ACTIVATE; CurrForm.UPDATE; It does not work. Please advise. Pari Somasundaram

Why you don’t want to use normal “Table Lookup” (F5)? Make form’s global variable OrderNo (Code,20). Place control on form with “Source Expression”=OrderNo and remove original order’s “No.”. In OnAfterGetCurrRecord() trigger assing value to this variable: OrderNo := “No.”; In OnValidate() trigger of control (OrderNo_Control) place your code for lookup. GET(OrderNo); In OnAfterValidate() trigger of control (OrderNo_Control) refresh form. CurrForm.UPDATE; Business Applications Programmer Sertified Navision Developer SIA “Sintegra” Latvia

A couple of tricks you might want to try… - Use the ActiveControlOnOpen of the form - Take the current control that is getting the focus and change it for the one currently with No. (This is brutal, but sometimes it seems to work :)) Chris Krantz NCSD,NCSQL,MCSD,MCSE Microforum Inc. Toronto, Ontario, Canada

quote:


Originally posted by AlexeyPavlov: Why you don’t want to use normal “Table Lookup” (F5)? Make form’s global variable OrderNo (Code,20). Place control on form with “Source Expression”=OrderNo and remove original order’s “No.”. In OnAfterGetCurrRecord() trigger assing value to this variable: OrderNo := “No.”; In OnValidate() trigger of control (OrderNo_Control) place your code for lookup. GET(OrderNo); In OnAfterValidate() trigger of control (OrderNo_Control) refresh form. CurrForm.UPDATE; Business Applications Programmer Sertified Navision Developer SIA “Sintegra” Latvia


Thanks. I did change the Record’s field to a global variable and in the onValidate trigger of the variable(textbox), did a GET(OrderNo) and it worked. Thanks again.