Selecting label OnClick does not recognize changed form field?

mdnuts

Registered User.
Local time
Today, 17:45
Joined
May 28, 2014
Messages
131
Access 2007
Unbound Form

I have a onclick tied to a label (for decoration purposes) that when clicked it launches VBA that essentially updates a form. All that part works except it will not recognize any changed value of the field I was last in?

Just to try to explain best as I can what happens.
- Form gets opened
- I change field (quantity field)
- I click the Label
- It reverts to pre-existing value.

if I click off of the text field first then do the onclick - it recognizes just fine.

Any ideas? I haven't seen this before.
 
Try adding a...

Code:
DoCmd.RunCommand acCmdSaveRecord

...in the Header of the code in the On_Click event of the Label because it sounds like the record is not committed yet.
 
thank you - that did it.

but why?

is it similar to various updating situations where Me.Dirty comes into play - like a losing focus?
 
Nope, losing the Focus does not count when it comes to saving the record. The actual save takes place when you leave the record and come back to it. While you are still on the record it's still *Dirty* meaning True, once saved it changes to False... so you need to force the save thereby turning Dirty to False.
 
interesting.

just odd I haven't run by it before. Although I think this is the first time i've used a label with an onclick instead of a button with onclick. Not sure why it'd make a difference.

Thank you!
 
Hmm, let me see if I can explain this correctly. The Label is *part of* the Form almost like being one with the Form. The Command Button produces and event or rather an action kind of separate from the Form.

Hope that helps!
 
It does I think.

I guess I was getting caught up in the way I use it is the same it's just the object itself (label vs button) that was different.
 

Users who are viewing this thread

Back
Top Bottom