There were two things wrong with your form.
1. The code on the button to add an instance was incorrect. You want to replicate Table 3 so the syntax woudl be:
2. Doing that generates an error indicating that the subform Table3 has reached the max number of instances. So go into the binding tab for the Table 3 object and set the "Reapeat Table ofr Each Data Item" checkbox on and you will be good to go.
Note that you may need to re-arrange your form as you will find that once the first column breaks a page (i.e. bathroom) then you cannot go back a page and fill up the second column.
Hope that helps
Now how do I get the total from the new boxes to add up together?
Are you looking to total up the table for a room or are you looking to total all tables into one final total from all rooms?
Both. I know how to get the overall total but dont know the code to make it add in the total for the new rooms?
This will involve some work ......you will need to name each of the rows in your table the same ...now you have it as row1, row2, row3 ......change it so that every row in the table has the same name (the product will add occurance numbers to make the fields unique). So if you named the rows Row then the result woudl be Row, Row, Row ......note that you do not add the [x] the product will do it. Then you need to change the name of the Total field in each row to be the same I called mine Total. The occurances numbers will appear the same way as the rows. Then create a formula to multiply quantity * Cost for each row. Now on your GrandTotal you can use a FormCalc calculation in the Calculate event of the Grand Total field. You can reference the Fields like this:
Note the use of the * in the occurance numbers ....this will reference every field with that structure so with a single statement we can add up all of the Totals from the General table and all Bathroom tables (note the * on the Table3 subform for when the user adds additional ones)....and as each row is completed the Grand Total will be calculated. You simply need to add an expression for each table you want to include in the GrandTotal calc ...sepearted by commas of course.
Lastly you should name all of your subforms ...it will make it easier when referencing objects in your Sum calculation.
I have modfied your previous sample to show you what I mean ( I did the General table and the Bathroom table only). See the attachment in this post.
MoveOutFinal_Pauls.pdf 942.8 K
Make sure that the settings in the Binding tab of the Object palette for the subform you are trying to duplicate are correct. There is a checkbox labeled "Repeat Subform for Each Data Item". Make sure that is checked. It gets reset every time you make the page positioned. If you have the Max checkbox checked, make sure there is a number > 1 in it.
The code to add an instance should look something like this in the click event of your add button: