Avatar

Level 2

Niall,

Thanks again! After a bit of tinkering it works great with one caveat, I hope you will be able to shed some light on this as well.

I am using a hidden "config" subform to hold a table in which the employee data (name and pay rate) is held. This "config table" is dynamic and I use a button to add rows as needed. I've also placed a button in each row to remove just that row, as opposed to removing the last or first etc. Thus if I have a 10 employees each on one row in the table, and decide to remove the employee name in the 5th row, I can do that without affecting the other rows. This was the easy part, thanks to an example file I found here - expandabletable-remthisrow.pdf (I think Stephan Cameron posted it - Thanks!)

I then set the "add" button to trigger adding a row in the corresponding section in the table on the main form. This works fine.

However, I would need to be able to set each "remove row" button to trigger the removal of the corresponding row from the table on the main form as well. This I have not been able to figure out.

For example, here is the code to add a row in the table that holds the data (in the hidden subform) for the salaried employees:

SAL._Item.addInstance(0);                                                                     

// adds row to table for salaried employees in config table

form1.page1.wrapper.CalcForm.Table1.Salaried._SAL.addInstance(0);        

//adds row to the Salaried section in the table on the main form

And here is the code to remove a specific row in the same table in the config table

this.parent.parent._Item.removeInstance(this.parent.index);                       

//removes the row

form1.page1.wrapper.CalcForm.Table1.Salaried._SAL.removeInstance(what do I use here?);

// not working so far

For example if I am removing the 5th row in the config table, I would want the corresponding (5th) row in the corresponding section of the table on the main form to be removed. All other rows before or after the removed row should remain unchanged.

Any suggestions?

Harry.