Display new record problem

KaliannaKalianna Member Posts: 5
Hi everyone,

I was wandering if there is a way to manage this situation:

I have a form on table A. From this form there is a function that calls another form in which the user can input data in order to insert a new record in table A.

There is a way to close the second form and display automatically in the first form the record just inserted?
For now I only have managed to obtain this without close the input form, but so three forms remains open.. ](*,)

Any idea?
thanks in advance!

Comments

  • BeliasBelias Member Posts: 2,998
    in your "form b" you do your code to insert the new record and then you do a
    currform.close
    
    :-k
    P.S.: isn't there a senior dev to help you?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • KaliannaKalianna Member Posts: 5
    thanyou, but maybe I wasn't cleare in the explanation.

    the problem isn't close the form B, but have the new record inserted displayed in form A after close the form B.

    imagine to call a function from Customer Form in order to create a clone of the current customer but with some changes. In form B I ask the fields that have to be changed. Clicking ok I close the form B but in Customer Form remanins the old record.
  • BeliasBelias Member Posts: 2,998
    Ok, now i think i understood. You're talking about a card form, not a list form. It's a totally different story...
    -you open the form based on tabl A (let's say the customer form), and you're currently on record X0001
    -you run your form B from here and then compile some fields and hit a button to confirm (customer X0010 is created)
    -you get back to customer form (and you are still on the record X0001)
    Now the question is: what do you need to do to change the pointer to the record on the card page? GET the value of the pk of the record you have just created
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • MBergerMBerger Member Posts: 413
    Maybe you should do a currform.update(false) on the first form when you return from the second ?
  • KaliannaKalianna Member Posts: 5
    So far I tried both the setrecord and the settableview (after get on the correct record of course) on the form, but nothing..

    update(false) gives me an error in closing the second form
  • BeliasBelias Member Posts: 2,998
    you're obviously missing something: GET must work if you call it in the right way.
    your code (under the button that runs the function) should be like this:
    myform.myfunction; // optional
    myform.RUNMODAL; // runmodal is important. if you use run, check the online help to see what's the difference between RUN and RUNMODAL
    mynewcustomer := myform.getcreatedcustomer; //this function returns the customer code that your form B has created
    GET(mynewcustomer);
    
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • KaliannaKalianna Member Posts: 5
    solved, I was trying to get the record from the second form instead than from the first :oops:


    thanks!
Sign In or Register to comment.