Re: Multiple records on one UserForm
Hi heytoluca,
Not angry, just confirming, there IS (or at least WAS) a forum here where you can pay to have someone develop a solution. Just wanted to make sure you were in the right place.
a Multipage is more...... intuitive, but it depends on how many boxes are likely/possible. a multipage with 20 tabs would be a BAD thing.
looking at the code that you have currently, you have a ways to go.
Firstly I'd look at how you are "storing" the information. You can of course store it in variables, but writing it to a worksheet is likely to be....... better. I'd look at your data structure, and determine what you need saved, and how to save it to start off with. The "Interface" is generally not the first you (I) do.
With the userform, currently you save the boxnumber as a variable when the combobox is set, which is fine. personally, I'd disable the next and previous box, and only enable them when the user has input multiple boxes. so the on change event (or better the on exit event so that typing "10" doesn't trigger the code twice) of the combobox should 1)save the number of boxes, 2) enable the next button, 3) Set the box number to 1 4) move the focus to the long text box.
When the Next button is pressed, check that all tesxtboxes have valid entries, SAVE everything related to that box somewhere (ie a sheet), increment box number, clear the text boxes, set the focus back to the long box.
This should be enough to get you started. Slightly more advanced concepts include when the "box number" is changed (should only be automatic, but the event still fires), if the number is one, disable previous, otherwise enable it. if the number = the number of boxes, disable next, otherwise enable it.
When next or previous is checked, (as above) validate the values in the text boxes and save the current "box", but THEN, increment or decrement the box number, and CHECK THE SHEET to see uif the user has already entered information for the new box number. If so display it, otherwise display blank fields
I'm sure there is more, but that should be enough to get you started with your current approach.