I haven't a clue how you would programme a button to generate a table based on the user selecting the number of rows and columns. It probably can be done, but I don't know how!
However if there are only a few combinations for the number of columns, you could create the tables each in its own subform. Then the script would show and hide the subforms depending on the users input.
For example you could have a dropdown with the number of columns (2; 3; 4) which the user selects. On the exit/change event you could have script like:
All subforms could initially be set to hidden. Each subform would be set to flowed and then all three subforms would be in a containing subform also set to flowed.
Dealing with the number of rows, each table could have one row with an add.instance button set to add additional rows. Because the table is already in a flowed subform, the user can add as many rows as you want to set.
If I was doing it, I would set up the table with the maximum number of rows first and get that working perfectly. Then I would duplicate that whole subform and rename.