Position cursor on lookup form displaying filtered records

havhav Member Posts: 299
Hi all,
I have created a table TableA(field1, field2.....................G/LAccNo). I have set the TableRelation property of G/LAccNo as ""G/L Account".No. WHERE (Account Type=CONST(Posting),Direct Posting=CONST(Yes),Gen. Bus. Posting Group=FILTER(<>''),Gen. Prod. Posting Group=FILTER(<>'')).

I then created a form FormA containing one textbox control "G/LAccountNo". The textbox control has below properties -
LookUp = Yes
LookupFormID = G/L Account List
SourceExpr = "G/LAccNo"

The FormA has SourceTable = TableA.

Now i run the form FormA and click on the assistbutton next to the textbox control "G/LAccountNo". The "G/L Account List" pops up and it shows only those records which are filtered acc. to the table filter which i had set on TableA.
I select No = 8120 and press Ok. The control "G/LAccountNo" now contains the value 8120.

I then close the form FormA and reopen it. Again i click on the assistbutton of the control "G/LAccountNo". The "G/L Account List" pops up but this time the cursor is NOT set on the record with No = 8120.

Each time i try to lookup on the form "G/L Account List" , the cursor is set to the first record of the filtered recordset. However the control does retain the selected No value.

Any idea why this happens and how to set the cursor on the selected record of the lookup form?

Thanks
Regards,
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)

Comments

  • lubostlubost Member Posts: 628
    I think, that the best solution for you is to set TableRelation property of G/L Account field in your table and remove all settings from table box control.
  • MbadMbad Member Posts: 344
    Is the field not in the table you use as sourcetable for the main form? If it is why done you just add the field without all the properties?
  • mukshamuksha Member Posts: 274
    May I know what is in the the primary key of the table and is it necessary to put Gen. Prod. Posting Group=FILTER(<>'')) in your filter.
    Mukesh Sharma
  • havhav Member Posts: 299
    I think, that the best solution for you is to set TableRelation property of G/L Account field in your table and remove all settings from table box control.

    With TableRelation property set for the GLAccNo field of TableA, i do achieve the Lookup functionality but the problem still persist. The cursor is not set on the value displayed in the text box control when i lookup.
    May I know what is in the the primary key of the table and is it necessary to put Gen. Prod. Posting Group=FILTER(<>'')) in your filter.

    The field Field1 of TableA is the primary key.

    The reason for providing the table filter is that i will use the GLAccountNo value to create sales lines of type G/L Account and i think Navision uses the same filter if G/L sales lines are to be created on Sales Order or Quote form. Thus i do not want user to select a G/L Account No from Lookup which ultimately cannot be used to create G/L Account sales lines. So i want to display the filtered recordset in the Lookup table.
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
Sign In or Register to comment.