Set focus on the subform record

kvbkvb Posts: 97Member
edited 2005-01-03 in Navision Attain
Hi all.

There is a purchase order form.
There is a button with some code on it.
I need to set cursor in purchase lines subform to a definite record.

Anybody know how can i do such thing?

The only solution that i have is to use timer.
But it is very bad solution i think.

I also try to use CurrForm.PurchLines.FORM.SETRECORD
but it was not allright.

Your ideas are welcome.

Comments

  • mhoganmhogan Posts: 5Member
    This may work

    CurrForm.Subform.ACTIVATE;

    But do you also need to position the cursor to a specific record or just the subform?
  • kinekine Posts: 12,562Member
    Add procedure in subform, which take parameter which record to select, add code to select this record and set focus on it (and update form etc.) and call this procedure from main form...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kvbkvb Posts: 97Member
    mhogan wrote:
    This may work

    CurrForm.Subform.ACTIVATE;

    But do you also need to position the cursor to a specific record or just the subform?

    to a specific record.
  • kvbkvb Posts: 97Member
    kine wrote:
    Add procedure in subform, which take parameter which record to select, add code to select this record and set focus on it (and update form etc.) and call this procedure from main form...

    I have already try to do this.

    I create a procedure in subform with one parameter "pi_LineNo:Integer"
    and run it from main form.
    The code in procedure was simple:
    GET("Document Type", "Document No.", pi_LineNo);
    

    At this procedure system(for some reason) tried to rename current record on a subform with key id:
    "Document Type", "Document No.", "Line No."
    to:
    "Document Type", "Document No.", pi_LineNo.

    There is a message: "Do you want to rename the record?"
    Since i don`t want to rename record but only to set focus - such solution doesn`t suit me :(

    Any other ideas?
  • kinekine Posts: 12,562Member
    try
    CurrForm.Update(true);  //or try false
    GET("Document Type", "Document No.", pi_LineNo);
    CurrForm.Update(true);  //or try false
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kvbkvb Posts: 97Member
    kine wrote:
    try
    CurrForm.Update(true);  //or try false
    GET("Document Type", "Document No.", pi_LineNo);
    CurrForm.Update(true);  //or try false
    

    It works! Thanx, kine :D

    The final code in procedure should be:
    GET("Document Type", "Document No.", pi_LineNo);
    CurrForm.UPDATE(FALSE);
    
  • PaLPiTaTioNPaLPiTaTioN Posts: 55Member
    Neat! I had the same problem ("do you want to rename...") and I only had to change "CurrForm.UPDATE" to "CurrForm.UPDATE(FALSE)" to solve it. Thanks!!
  • RamboRambo Posts: 3Member
    It works in Sales Order for example.

    But i have a Page and a SubPage whit temporary records and not works :( Maybe whit temporary records is not possible do this?
Sign In or Register to comment.