Active Member
February 25, 2020
Hi
could anyone help me with the step by step to adding an Update, Previous and Next Buttons to my form
The Job Management sheet is where we enter our data that is stored on the second worksheet “data”
The submit and clear form buttons both work, but I needed a previous and next button so that we could navigate in between the records stored on the “Data” worksheet.
Also a button to update information if we add to update a record previously recorded, because currently the submit will only save as a new line of data, don’t want double ups if that makes sense?
Thanks
Mariam
Active Member
February 25, 2020
Hi Philip
I hadn't read that post, thank you!
Problem is I'm not great at this whole thing and needed a step by step if possible!
The Job Management worksheet in my spreadsheet is my form, and I just needed to add buttons to that form. Can I do that by copying the code in the link you shared and refer to my own "Data" sheet?
Thanks again
Mariam
October 5, 2010
Hi Mariam,
What you've got on your 'Job Management' isn't actually a form as it is known in Excel. A userform is a pop-up that you have to design and write VBA for it to make it work.
The 'Job Management' sheet is just a regular sheet that you are populating with data from another sheet.
So you already have VBA written to save new data to the Data sheet, what you require is just a case of modifying that code to load data from the Data sheet.
In the attached workbook I have created a Next and Previous button and written some (not completely finished) code to load data from Data to Job management.
You'll see that the Next button calls the NextRecord sub and the PreviousButton calls the PreviousRecord sub. Both subs call the LoadData sub which is what does the work of loading data into Job Management.
I trust that you will be able to complete the LoadData sub - call it homework 🙂 But all you need to do is load the data into the various fields which are already listed in your job_management sub.
As for an Update button, you can achieve this functionality by modifying the job_management sub to save the data back to the Data sheet. You can use the value in A1 on the Job Management sheet to know which record you are modifying. I added this as my new subs need this value. I've created a name for it - RecordNum.
Give it a go and let me know if you get stuck.
Regards
Phil
Answers Post
1 Guest(s)