Form Control Value Change

timothyd

Registered User.
Local time
Today, 09:04
Joined
Feb 9, 2010
Messages
41
Hello,

Is there a event that can be called if controls on the form change value after the user changes them? I want to change a boolean value in VBA that determines if the form has been altered and whether it needs to save the values on the form or not. The controls are unbound if that makes any difference. If you want more information please let me know. I also have already tried the event called On Data Change and On Data Set Change which have not worked. Thanks!
 
Hi

Never thought of having a change event used in that way as I always use them with underlying data changes.

Just a thought but, rather than having a boolean change on each of the controls (as I assume you have to have the event attached to each control and then test each one to see if the boolean has changed), would it be easier to take a value of each control as it loads and then test it against the current values of the controls at the point where you want to save (or not!)?

Andy
 
I currently do not have an event for each control because there are 60 controls that may or may not be in use at the time and that is a bunch of code that I would rather not mess with. I was hoping that the form could detect if any of its controls changed value and that would throw an event.

As for checking against the current value, I think it would be just as easy to save the value and keep moving on as to check it. For some reason, my form lags (only two or three seconds) a bit when I want to save, thus the reason I want to know if any value has changed so I know if I need to save or not. I have tried to figure out what causes the lag because I have another form that I has up to 200 controls (of which far more get used) and there is hardly any lag. I am using the exact same technique but I somehow get lag.

I might also want to add that when there is lag, my control buttons flicker. I have never seen this so if someone else has, that could be helpful. Also, the 60 controls on this form are combo boxes while the 200 controls on the other form are text boxes, if that makes a difference.

I hope that sheds a bit more light on the subject.
 
I currently do not have an event for each control because there are 60 controls that may or may not be in use at the time and that is a bunch of code that I would rather not mess with. I was hoping that the form could detect if any of its controls changed value and that would throw an event.

Well, if they were BOUND controls then you would have the form's On Dirty event to know if something was changed.

But I threw together a little sample of how you can have a bunch of controls, add an event for each of them withOUT having to do it manually.

Check it out.
 

Attachments

Sadly, I can't make the controls bound because the form is taking two multiple records in the query and bringing them up onto one form page.

I do like what you showed me though. I will have to try to implement that. Thanks!
 

Users who are viewing this thread

Back
Top Bottom