By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,681 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,681 IT Pros & Developers. It's quick & easy.

Which event(s) can I use to catch a change of a field on subform?

P: n/a
Hello
I have an application in MS Access 2000. I have a form, which includes
a subform. The subform is based on a table, but locked for any
editing. There is Edit button. When clicked, it starts a separate
unbound form with all the fields, which are on the subform. The fields
are filled in with data programmatically. User edits. Edited fields
are copied into fields on the subform programmatically as well.
I need to catch change in one of the fields either at the moment, when
the change gets into the field on subform, or when user clicks a
navigation button on the parent form to navigate to another record.
I cannot use OnChange event of this field, because OnChange event
doesn't work, if field is changed from code.
I tried If Dirty and AfterUpdate events of the subform and AfterUpdate
event of the control, but despite the fact that the change is saved in
the table, the form doesn't become dirty and doesn't even start
AfterUpdate event, to my greatest surprise. I thought that if a value
is changed in the form based on a table, AfterUpdate event happens
always...
Which event(s) can I use to catch a change of a field on subform? Any
advice will be greatly appreciated.
Thank you.
Galina
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 26 Jan 2004 07:23:07 -0800, Galina wrote:
Hello
I have an application in MS Access 2000. I have a form, which includes
a subform. The subform is based on a table, but locked for any
editing. There is Edit button. When clicked, it starts a separate
unbound form with all the fields, which are on the subform. The fields
are filled in with data programmatically. User edits. Edited fields
are copied into fields on the subform programmatically as well.
I need to catch change in one of the fields either at the moment, when
the change gets into the field on subform, or when user clicks a
navigation button on the parent form to navigate to another record.
I cannot use OnChange event of this field, because OnChange event
doesn't work, if field is changed from code.
I tried If Dirty and AfterUpdate events of the subform and AfterUpdate
event of the control, but despite the fact that the change is saved in
the table, the form doesn't become dirty and doesn't even start
AfterUpdate event, to my greatest surprise. I thought that if a value
is changed in the form based on a table, AfterUpdate event happens
always...
Which event(s) can I use to catch a change of a field on subform? Any
advice will be greatly appreciated.
Thank you.
Galina


If your changes are being made in a form other than the one you want to
update, then the Update/Change/Dirty events on the first form are not
firing as nothing has occured on that one. You'll need to have the form
used for editing tell the first form to refresh itself -
Forms!FirstForm.Refresh

If you want the first form to retain it's record posistion after the
refresh, it may be necessary to determine what record is active first, then
either filter the form after refresh, set it's bookmark to the desired
record or using one of the Find methods of it's recordsetclone.
--
Mike Storr
veraccess.com
Nov 12 '05 #2

P: n/a
Mike
Thank you. I should have known it myself.
Galina
Mike Storr <st******@sympatico.ca> wrote in message news:<1k*******************************@40tude.net >...
On 26 Jan 2004 07:23:07 -0800, Galina wrote:
Hello
I have an application in MS Access 2000. I have a form, which includes
a subform. The subform is based on a table, but locked for any
editing. There is Edit button. When clicked, it starts a separate
unbound form with all the fields, which are on the subform. The fields
are filled in with data programmatically. User edits. Edited fields
are copied into fields on the subform programmatically as well.
I need to catch change in one of the fields either at the moment, when
the change gets into the field on subform, or when user clicks a
navigation button on the parent form to navigate to another record.
I cannot use OnChange event of this field, because OnChange event
doesn't work, if field is changed from code.
I tried If Dirty and AfterUpdate events of the subform and AfterUpdate
event of the control, but despite the fact that the change is saved in
the table, the form doesn't become dirty and doesn't even start
AfterUpdate event, to my greatest surprise. I thought that if a value
is changed in the form based on a table, AfterUpdate event happens
always...
Which event(s) can I use to catch a change of a field on subform? Any
advice will be greatly appreciated.
Thank you.
Galina


If your changes are being made in a form other than the one you want to
update, then the Update/Change/Dirty events on the first form are not
firing as nothing has occured on that one. You'll need to have the form
used for editing tell the first form to refresh itself -
Forms!FirstForm.Refresh

If you want the first form to retain it's record posistion after the
refresh, it may be necessary to determine what record is active first, then
either filter the form after refresh, set it's bookmark to the desired
record or using one of the Find methods of it's recordsetclone.

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.