Touching field

J

John

Hi

Is there any way to programmatically make a field think its value has
changed without actually changing its value? Would me.field = me.field do it
for instance?

Thanks

Regards
 
D

Dirk Goldgar

John said:
Hi

Is there any way to programmatically make a field think its value has
changed without actually changing its value? Would me.field = me.field do
it for instance?

Yes, depending on what you mean by "mak[ing] a field think its value has
changed". The record will be dirtied, but the events associated with user
input in the control won't fire. What do you want to accomplish.
 
J

John

To fire the after update event if possible.

Thanks

Regards

Dirk Goldgar said:
John said:
Hi

Is there any way to programmatically make a field think its value has
changed without actually changing its value? Would me.field = me.field do
it for instance?

Yes, depending on what you mean by "mak[ing] a field think its value has
changed". The record will be dirtied, but the events associated with user
input in the control won't fire. What do you want to accomplish.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

John said:
To fire the after update event if possible.


Dirk Goldgar said:
John said:
Is there any way to programmatically make a field think its value has
changed without actually changing its value? Would me.field = me.field
do it for instance?

Yes, depending on what you mean by "mak[ing] a field think its value has
changed". The record will be dirtied, but the events associated with
user input in the control won't fire. What do you want to accomplish.


The control's AfterUpdate event won't fire if you change its .Value in code.
You *could* do it by setting the focus to it and setting its .Text property;
e.g.,

With Me!MyField
.SetFocus
.Text = .Text
End With

Doing it that way would fire the control's AfterUpdate event.

However, are you aware that, if you have an event procedure for the
control's AfterUpdate event, you can call that procedure directly in your
code? You don't have to modify the control's .Value or .Text at all. Just
call the procedure:

Call MyField_AfterUpdate

That is much cleaner and simpler, it seems to me, than dirtying the control
just to get its AfterUpdate event to fire.
 
T

tina

you have code in a control's AfterUpdate event procedure? have you tried
calling the procedure from wherever else in your code you're wanting it to
run?

hth


John said:
To fire the after update event if possible.

Thanks

Regards

Dirk Goldgar said:
John said:
Hi

Is there any way to programmatically make a field think its value has
changed without actually changing its value? Would me.field = me.field do
it for instance?

Yes, depending on what you mean by "mak[ing] a field think its value has
changed". The record will be dirtied, but the events associated with user
input in the control won't fire. What do you want to accomplish.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top