|
-
Nov 8th, 2007, 06:12 PM
#1
Thread Starter
New Member
[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.
-
Nov 8th, 2007, 06:36 PM
#2
Re: saving changes to a form at runtime
Thread moved to Office Development forum
-
Nov 8th, 2007, 07:01 PM
#3
Frenzied Member
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.
Tengo mas preguntas que contestas
-
Nov 9th, 2007, 02:29 AM
#4
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 9th, 2007, 07:24 AM
#5
Re: saving changes to a form at runtime
If the registry is not locked down, that would be my choice.
-
Nov 9th, 2007, 07:52 AM
#6
Thread Starter
New Member
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
-
Nov 9th, 2007, 08:14 AM
#7
Re: saving changes to a form at runtime
It will work. It takes a bit of coding and testing, but not all that much.
-
Nov 9th, 2007, 01:11 PM
#8
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 9th, 2007, 03:42 PM
#9
Frenzied Member
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.
Tengo mas preguntas que contestas
-
Nov 12th, 2007, 08:00 AM
#10
Thread Starter
New Member
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.
-
Nov 12th, 2007, 10:29 AM
#11
Re: saving changes to a form at runtime
Welcome to the forums. 
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|