Hi all could someone advise me on a soultion to canceling a userform with data already in it please - bearing in mind my VB knowledge is very basic.
So I have a button on a form 'frm1'. The form has 23 textboxes all of which a user is required to put some data in. Once all the textboxes have been completed the user clicks the 'Save' button and the data is written to the worksheet. (all of this is working fine)
But if a user wants to cancel the form without saving anything, they should simply click the Cancel button.
What I have so far is the Cancel button coded to run a msgbox "are you sure you want to cancel etc etc" and the VB Yes No option set.
The problem I'm having is as all the textboxes on the form require something entered in each of them as soon as I press the cancel button, the code behind the first textbox runs i.e. a msgbox "you must enter a value".
So my question is how do I stop this happening? Do i need to 'disable' the textboxes first or is there a simple way to do this?
Many thanks for any advice offered
Paul
So I have a button on a form 'frm1'. The form has 23 textboxes all of which a user is required to put some data in. Once all the textboxes have been completed the user clicks the 'Save' button and the data is written to the worksheet. (all of this is working fine)
But if a user wants to cancel the form without saving anything, they should simply click the Cancel button.
What I have so far is the Cancel button coded to run a msgbox "are you sure you want to cancel etc etc" and the VB Yes No option set.
The problem I'm having is as all the textboxes on the form require something entered in each of them as soon as I press the cancel button, the code behind the first textbox runs i.e. a msgbox "you must enter a value".
So my question is how do I stop this happening? Do i need to 'disable' the textboxes first or is there a simple way to do this?
Many thanks for any advice offered
Paul