Quote:Sometimes there are only one of two lines and sometimes there might be 10 lines or more.
That's okay, luckily, Sesame can tell us how many there are.
Quote:...programming in the main form On Form Enter? Won't that programming run as soon as I exit the subform lines...?
No, it won't. Sesame does not consider moving from a subform to the parent an On Form Entry event. You would need to advance to the next parent record and back again, for the On Form Entry event to execute.
Quote:If I have a button on the main form I will have to remember to click on it. Should I put the programming in the main form On Form Enter?
Well, you have a few choices here.
1) There's nothing to stop you from putting the code in the command button AND another event, like the the parent's On Form Exit. That way, if you want to see the line numbers right away, you can click on the button. If you don't care to see them right then (or if you forget to click the button), the parent's On Form Exit event will take care of it.
2) You could also place the same exact code in a subform event. If you put it in the subform's On Form Exit, it will re-number the lines every time you navigate up or down the subform lines. The only problem with this one, is that it can be a little distracting, because the gray highlight will scan from the top subform line to the bottom one every time you navigate up or down.
3) If you don't need to see the new numbering until the next time the parent form is viewed, you could simply place the code in just the parent On Form Entry event.
Just keep in mind that placing the code in an exit or entry event for the parent, may slow you down while navigating the parent records - especially if there are a lot of subform lines. In any case, you'll probably want to test it in a few different events to see what works best for you.
var vCnt as int //Subform count
var i as int //Subform instance
//Tells us the number of subforms for this parent
vCnt = @FormResultSetTotal("MySubform")
//Loop through all of the subforms
//"MyLE" is the name of the subform LE that you want the line number in
For i = 1 to vCnt
FormFieldValue("MySubform", "MyLE", i, i)
Next
Let me know how you make out.