Setting Focus OnLookup

lloydsmodslloydsmods Member Posts: 93
Using Navision 3.7, native DB.

I have a list form which displays transactions filtered based on variables in the header of the form. The variables are lookups on the customer table and several other tables.

For example, I have a variable called "varCustomer" which is a code10. The field TableRelation is Customer."No."

When you enter a value in varCustomer, and then hit F6 or click on the lookup arrow, it opens the Customer List form (form 22), but the focus is not on the customer code entered. It is either at the top of the list or on the last record selected.

Any idea how to set the focus on the lookup list?
If guns cause crime mine must be defective.

Comments

  • kinekine Member Posts: 12,562
    You will need to use the OnLookup trigger to write appropriate code...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Alex_ChowAlex_Chow Member Posts: 5,063
    lloydsmods wrote:
    Using Navision 3.7, native DB.

    I have a list form which displays transactions filtered based on variables in the header of the form. The variables are lookups on the customer table and several other tables.

    For example, I have a variable called "varCustomer" which is a code10. The field TableRelation is Customer."No."

    When you enter a value in varCustomer, and then hit F6 or click on the lookup arrow, it opens the Customer List form (form 22), but the focus is not on the customer code entered. It is either at the top of the list or on the last record selected.

    Any idea how to set the focus on the lookup list?

    I think I know what your problem is. Please post your code up here so that we may address it.
  • lloydsmodslloydsmods Member Posts: 93
    I don't have any code to post, really.

    The form is a list, with a header at the top which contains text boxes tied to global variables. The list is filtered based on your entries in the text boxes.

    In the properties of those boxes I have, for example:

    LookUp: <No> (or Yes, makes no diff)
    SourceExpr: varCustomer (which is a Code10)
    TableRelation: Customer.No.
    LookupFormID: <undefined> (although defining this makes no diff)

    There is no code in the OnLookup function for that text box. Any suggestions as to what the appropriate code would be?
    If guns cause crime mine must be defective.
  • Alex_ChowAlex_Chow Member Posts: 5,063
    I see...

    Since your lookup is using a variable, it does not set the proper record because the variable has not been initialized.

    You won't be able to just do a regular table relation based on the variable. You'll need to write the lookup manually.
Sign In or Register to comment.