Trigger event on change to unbound text in unbound form programmat

G

Guest

I’m developing an adp (access project)

I have an unbound field in an unbound form that I need to check for changed
data from another form to trigger an action. I don’t seem to generate an even
when that happens.

Let me explain:
I have built a dashboard form that collects information from many tables. A
set of those text controls return date fields from different tables. If I
uses an after update on any of these controls I can write to the appropriate
table (so far no problem).

I have a form that is essentially a calendar in dialog box to improve the
user interface. Double click on any txtbox that should contain dates and the
date is shown in the calendar. Change the calendar and the date appears in
the appropriate text box (so far no problem)

If I change the date in any text box by physically overwriting the contents
the after_update event works. If I change the date by using my calendar
control dialog form the text box renders the correct date, but I can’t seem
to trigger an event.

Any suggestions (without having to write ugly, unmentionable code in the
calendar form since each textbox does something different?)

Thank you for any recommendations.
-- Abe
 
B

Brendan Reynolds

The Before and After Update events of a control are not fired when you
change the value of that control programmatically, if that is what you mean.
The usual solution is to call any code that you would have called from the
Before or After Update event from the code that changed the value. If you
don't want to do that, a possible alternative might be to use the Timer
event of the form. Use a static variable in the Timer event to keep track of
the previous value of the control, and compare that to the current value.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
G

Guest

Thanks Brendan. So there's no equivalant of on_dirty or ANY other event that
triggers when a value changes as far as you know? I'm trying to keep the
design clean.
-- AbeR
 
B

Brendan Reynolds

Sorry, I can't comment on the OnDirty event, as I've never tried to use it.
There are enough users out there with older versions of Access to make me
cautious of depending on features that only exist in recent versions.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
J

John Doe

Try using the OnChange event for the date field instead of the
AfterUpdate event.

That seems to work pretty well for me (I have a database app that I'm
basically doing the same thing).


The Before and After Update events of a control are not fired when you
change the value of that control programmatically, if that is what you mean.
The usual solution is to call any code that you would have called from the
Before or After Update event from the code that changed the value. If you
don't want to do that, a possible alternative might be to use the Timer
event of the form. Use a static variable in the Timer event to keep track of
the previous value of the control, and compare that to the current value.
 
G

Guest

Thanks!

John Doe said:
Try using the OnChange event for the date field instead of the
AfterUpdate event.

That seems to work pretty well for me (I have a database app that I'm
basically doing the same thing).
 

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