Confirm Add New Part

shaneshane Member Posts: 20
Hello all,

My company has Navision 4.0 SP1 and we have the Item table set to automatically assign a number when creating part numbers. The problem is that people are looking at the item card and scrolling to the last number and then accidentally creating a new part when they TAB off the blank number field.

So what I did is this on the Item Card:
Form - OnNewRecord(BelowxRec : Boolean)
IF CONFIRM('Are you sure you want to create a new part?') = FALSE THEN BEGIN
    ERROR('');
END;

But this is not the best solution. I would like it if rather than ERROR(‘’) I could just set the card to the last item number and not exit the card. I have tried several things to accomplish this and I keep having problems.

Any suggestions?

Answers

  • DenSterDenSter Member Posts: 8,307
    I'd probably make the No. field not editable, and give the user a button or a selection on the Functions menubutton to create a new Item.
  • CogCog Member Posts: 12
    edited 2006-05-18
    Hi shane,
    please try this...
    Form - OnInsertRecord(BelowxRec : Boolean) : Boolean
    
    IF NOT CONFIRM('Are you sure you want to create a new part?',FALSE) THEN
      EXIT(FALSE);
    EXIT(TRUE);
    
  • ashadam999ashadam999 Member Posts: 1
    Instead of using OnNewRecord, use OnInsertRecord. Then you can do this:


    Form - OnInsertRecord(BelowxRec : Boolean) : Boolean
    IF NOT CONFIRM('Are you sure you wanna make da new item?') THEN BEGIN
    GET(xRec."No.");
    EXIT(FALSE);
    END;

    The Get will reposition to the last record you were on. If you want it to go to the last record just change it to find('+').
  • shaneshane Member Posts: 20
    Brilliant, thank you guys…

    …my final solution looks like your suggestion ashadam999:
    Form - OnInsertRecord(BelowxRec : Boolean) : Boolean
    IF NOT CONFIRM('Are you sure you want to create a new part?') THEN BEGIN
      GET(xRec."No.");
      EXIT(FALSE);
    END;
    

    I like "GET(xRec."No.");". This behaves better than I originally had in mind.

    Thanks again,
    Shane
Sign In or Register to comment.