on enter field

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I want to set a field on a form to zero when I enter the field. Then,
the user can go ahead and overwrite the zero if necessary.

So, on the On Enter event, I have:

me.txtSomeField = 0

That works ok. But, unless the user does actually overwrite the data,
the after update event doesn't fire.

I thought by setting the value to zero, that would dirty the field. I
even have:
me.dirty = true
but that doesn't help to fire the afterupdate event.

Any solutions? Of course, I can simply move the code to On Exit, but
I was curious.

Also, what is the difference between
me.txtSomeField = 0

and
me.txtSomeField.value = 0

they both seem to work, so what is the difference?

Thanks, Steve
 
Depending on what you are trying to do, it might be easier to set the
default value of the field to 0.

Cindy
 
Setting field (really, >control<) values via VBA does not fire the before-
or after- update events.

HTH,
TC
 
I didn't do that because I wanted to:
If user comes back to this field/control using the mouse (rather than
tabbing into and out of), the first thing I want to happen is to dirty
the control (could set it to zero or to null0, thus forcing the user
to re-enter the data.

I guess I'll just use the OnExit event instead.

Thanks, Steve
 
Back
Top