Set focus on the subform record

kvbkvb Member Posts: 107
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 Member Posts: 5
    This may work

    CurrForm.Subform.ACTIVATE;

    But do you also need to position the cursor to a specific record or just the subform?
  • kinekine Member Posts: 12,562
    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 Member Posts: 107
    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 Member Posts: 107
    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 Member Posts: 12,562
    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 Member Posts: 107
    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 Member Posts: 55
    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 Member Posts: 3
    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.