FORM.RUNMODAL always focused on the top record

brimfredbrimfred Member Posts: 14
I'm using FORM.RUNMODAL(FORM::"Customer List",cust_rec) to open a list with customers from an OnLookup code section of a customer no. field.

I use the OnLookup because I have to run some code after picking the customer from the list.

When the list is opened the record in focus is always the top record. I want it to be the record with the customer no. from the field. Is that possible?

Thanx!

Comments

  • SavatageSavatage Member Posts: 7,142
    HOw are you defining Cust_Rec?
  • brimfredbrimfred Member Posts: 14
    Then I only get the last record in stead of the first but I want it to be the record with the cust. no from the field.
  • ShedmanShedman Member Posts: 194
    You have to create the form as variable as well and then program it something like:
    Cust_rec.RESET;
    Cust_list.SETTABLEVIEW(Cust_rec);
    
    IF Cust_rec.GET("No.") THEN
      Cust_list.SETRECORD(Cust_rec);
    
    Cust_list.LOOKUPMODE(TRUE);
    Cust_list.RUNMODAL
    

    Then you get focus on the chosen customer, if it is found.
  • vijay_gvijay_g Member Posts: 884
    edited 2010-06-15
    Use GETRECORD And SETRECORD function of form.
    both post same time.....
  • brimfredbrimfred Member Posts: 14
    Thanks Shedman, your code worked fine.
Sign In or Register to comment.