Options

Problems with filter on form 132

TbiTbi Member Posts: 33
Hi.

A customer discovered a problem with the form 132 (Posted Sales Invoice). They sat a filter on the "No." field and entered a "No." that doesent exists, and then closed the form. Now they are unable to open that form again, because it says "Sales Invoice Header No. '**' does not exist.".
(** = the No. filter they applied on the form)

What is the best way to solve this problem?

Comments

  • Options
    kinekine Member Posts: 12,562
    Delete the zup file (will delete all saved states for the user) or make small change to the form if you have form designer (save the form in design is enough) - it will clear all settings of this form for all users (but only for that form)...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    TbiTbi Member Posts: 33
    Thanks for reply.

    Those where also the solutions I found, but I was hoping someone had a more 'userfriendly' solution. The customer can not change the form (and I don't want a phonecall everytime it happends..) I can tell them to delete the zup file for now, but I think the they will prefer a different solution if there is any..
  • Options
    kinekine Member Posts: 12,562
    Solution is to add line of code to the form>
      OnOpen
    
      if IsEmpty then
        SETRANGE("No.");   //if rec is empty, try to clear user No. filter
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    TbiTbi Member Posts: 33
    Thanks!
    I sat the No. to the first record of the table (if the table is not empty) if the form tried to open an record that doesen't exists. It worked perfectly.
  • Options
    kinekine Member Posts: 12,562
    And you are able to do PgUp and PgDown to list to next record???
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    TbiTbi Member Posts: 33
    Yes, PgUp/Down works fine.

    Code Inseted in form 132:
    Form - OnOpenForm()
    IF ISEMPTY THEN BEGIN
      IF rSalesInvoiceHeader.FIND('-') THEN
        SETRANGE("No.", rSalesInvoiceHeader."No.");
    END;
    
  • Options
    kinekine Member Posts: 12,562
    it works because there is this code in OnFind trigger:
    IF FIND(Which) THEN
      EXIT(TRUE)
    ELSE BEGIN
      SETRANGE("No.");
      EXIT(FIND(Which));
    END;
    

    If there is no such a code, your code will not allow user to list through records...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    TbiTbi Member Posts: 33
    Are you sure that is needed? I do not have any code in the OnFindRecord trigger. There is only one more line of code in this form..
    Form - OnAfterGetRecord()
    SETRANGE("No.");
    
  • Options
    kinekine Member Posts: 12,562
    I took the code from NA 4.00 - may be that older version have only the code in OnAfterGetRecord but the result is same... :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    TbiTbi Member Posts: 33
    Ah. Yes, I am currently working on v3.70A, so that explains the difference. Thanks for all replies!
Sign In or Register to comment.