[RESOLVED] saving changes to a form at runtime
I want to create an application (it is actually a vba addin application) where I have a form with 2 option buttons (option button 1 is set to true by default) and at run time lets say the user selects option button 2. How can i capture this change so that next time the form is opened it will still reflect the change ie. show that option button 2 is selected.
Re: saving changes to a form at runtime
Thread moved to Office Development forum
Re: saving changes to a form at runtime
I'm not sure you can if option1 is set true by default. You could save the value and on form Load check that value and set it appropriately.
Exactly the best way to do this would depend on the specifics of your app. For example, do you want it to be set to the last saved value overall, or the last saved value for each user? You may have other considerations as well.
Re: saving changes to a form at runtime
you would have to save that info somewhere, the main choices are inside the excel workbook, to the registry, use savesetting, very easy, or a text or ini file, any of those choices could accommadate multiple users if required
Re: saving changes to a form at runtime
If the registry is not locked down, that would be my choice.
Re: saving changes to a form at runtime
ok thanks - thats good idea - will try saving the values somewhere and see how that goes -will let you know if it works
Thanks again guys
Re: saving changes to a form at runtime
It will work. It takes a bit of coding and testing, but not all that much.
Re: saving changes to a form at runtime
I would opt for saving it to a file as registry access may be denied or restricted.
Re: saving changes to a form at runtime
If this is Access, you could also save it to a table. Or if records have a date/time stamp, get the value from the most recent record.
Re: saving changes to a form at runtime
well ive tried a couple of the above suggestions and i have found 2 different methods that work.
the saveSetting and GetSetting methods for saving and accessing data from the registry works
and i have simply managed save the variables to a worksheet in my addin workbork and used the 'thisworkbook.save' method to update the changes in my addin worksheet every time the user changes the option button on the form.
I suppose its now just a matter of deciding which is the most appropriate one, which may be the 2nd one for the reasons mentioned above regarding registry access. either way i think my problem seems to be sorted out.
thanks alot guys - that was very helpful indeed.
Re: saving changes to a form at runtime
Welcome to the forums. :wave:
If you consider this resolved, you could help us out by pulling down the Thread Tools menu and clicking the Mark Thread Resolved menu item. That will let everyone know that you have your answer.
Thank you. :)