Pass Record to Function or pass Primary Key and get Record

doddwelldoddwell Member Posts: 65
Hello

I have the following objects:

A table called "Retro Discount" and a form called "Retro Discount Card".
A table called "Retro Discount Schedule" and a subform called "Retro Discount Schedule Subfrm".
A code Unit called "Retro Discount Management" with a function called "CreateRetroSchedule"

The user presses a button on the Retro Discount Card which calls the CreateRetroSchedule function to create the Retro Discount Schedule records.

Should I:

1 - pass the "Retro Discount" record to the code unit
OR
2 - just pass the "Retro Discount" Primary Key value and then allow the function to GET the "Retro Discount" record

I know that both ways will work - I'm just wondering which way is the 'NAV' way?

Thanks Very Much. Simon

Comments

  • mdPartnerNLmdPartnerNL Member Posts: 802
    Both are ok. The record pass as a var would save you from creating a key in memory.

    More important is, do you expect the record to change in that function? Then save the changes first.
  • doddwelldoddwell Member Posts: 65
    Thanks for your help. I don't expect the record to change after the function is called from the form. However, I suppose there is a small chance it could be changed by another user - so I am thinking that I should pass the Primary key as a variable and then have the function get the record.
Sign In or Register to comment.