Forum

Update, Previous &a...
 
Notifications
Clear all

Update, Previous & Next Button

6 Posts
2 Users
0 Reactions
343 Views
(@mariam-singh81gmail-com)
Posts: 3
Active Member
Topic starter
 

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 

 
Posted : 26/02/2020 12:02 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Mariam,

Have you read this post

https://www.myonlinetraininghub.com/excel-forms-insert-update-delete

Regards

Phil

 
Posted : 26/02/2020 12:56 am
(@mariam-singh81gmail-com)
Posts: 3
Active Member
Topic starter
 

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 

 
Posted : 27/02/2020 7:20 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

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

 
Posted : 05/03/2020 8:36 pm
(@mariam-singh81gmail-com)
Posts: 3
Active Member
Topic starter
 

Hi Phil 

thank you! you are a legend

i will work on my update button homework and get back to you if i need any help 

thanks heaps 

Mariam 

 
Posted : 09/03/2020 10:42 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

You're welcome 🙂

 
Posted : 10/03/2020 12:35 am
Share: