Dirty Access Question

R

Rick Roubos

Background:
I've written an application that is running on a few machines. The majority
of the machines have Access 2000 installed with the remainder using Access
2003.


I used the Microsoft suggested method (method 2 of the Knowledge Base
Article
http://support.microsoft.com/default.aspx?scid=kb;en-us;210334&Product=acc)
to detect when a form is being edited based on the [Form].[Dirty] value. I
use it to control save, undo and various other buttons.

Everything works fine in Access 2000 but it does not work in Access 2003.
When I open the application (still in Access 2000 format) in Access 2003 and
look at the textbox with the control source =[Form].[Dirty] &
EditModeChange([Form]) during a run it shows #Name. I changed the control
source to =[Form].[Dirty] and it gave the same value. This value is not
allowed on forms in 2003? Any alternate value I can use?


As an aside, the form's OnDirty event does not fire after a bound control on
a bound form has changed, even after focus has moved off of that control.
Is this the standard behaviour for this event, to do nothing, ever?
 
A

Allen Browne

That article has never worked reliably, so it is not surprising that you
have run into problems after converting.

Forms now have a Dirty event and an Undo event. Use the Dirty event to
determine when the form is being dirtied.
 
R

Rick Roubos

That article worked very well for me using Access 97 and 2000 but can't work
with 2003. And the Dirty event is not firing for some reason.

I was hoping there was a solution that could work in both the 2000 and 2003
environments. It looks as if the workstations will have to revert to the
older version for now.

Allen Browne said:
That article has never worked reliably, so it is not surprising that you
have run into problems after converting.

Forms now have a Dirty event and an Undo event. Use the Dirty event to
determine when the form is being dirtied.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Rick Roubos said:
Background:
I've written an application that is running on a few machines. The majority
of the machines have Access 2000 installed with the remainder using Access
2003.


I used the Microsoft suggested method (method 2 of the Knowledge Base
Article
http://support.microsoft.com/default.aspx?scid=kb;en-us;210334&Product=acc)
to detect when a form is being edited based on the [Form].[Dirty] value. I
use it to control save, undo and various other buttons.

Everything works fine in Access 2000 but it does not work in Access 2003.
When I open the application (still in Access 2000 format) in Access 2003 and
look at the textbox with the control source =[Form].[Dirty] &
EditModeChange([Form]) during a run it shows #Name. I changed the control
source to =[Form].[Dirty] and it gave the same value. This value is not
allowed on forms in 2003? Any alternate value I can use?


As an aside, the form's OnDirty event does not fire after a bound
control
on
a bound form has changed, even after focus has moved off of that control.
Is this the standard behaviour for this event, to do nothing, ever?
 
B

Brendan Reynolds

There's a somewhat kludgy workaround - use the Timer event to test the
form's Dirty property.

--
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.


Rick Roubos said:
That article worked very well for me using Access 97 and 2000 but can't work
with 2003. And the Dirty event is not firing for some reason.

I was hoping there was a solution that could work in both the 2000 and 2003
environments. It looks as if the workstations will have to revert to the
older version for now.

Allen Browne said:
That article has never worked reliably, so it is not surprising that you
have run into problems after converting.

Forms now have a Dirty event and an Undo event. Use the Dirty event to
determine when the form is being dirtied.
http://support.microsoft.com/default.aspx?scid=kb;en-us;210334&Product=acc)
to detect when a form is being edited based on the [Form].[Dirty]
value.
I
use it to control save, undo and various other buttons.

Everything works fine in Access 2000 but it does not work in Access 2003.
When I open the application (still in Access 2000 format) in Access
2003
and
look at the textbox with the control source =[Form].[Dirty] &
EditModeChange([Form]) during a run it shows #Name. I changed the control
source to =[Form].[Dirty] and it gave the same value. This value is not
allowed on forms in 2003? Any alternate value I can use?


As an aside, the form's OnDirty event does not fire after a bound
control
on
a bound form has changed, even after focus has moved off of that control.
Is this the standard behaviour for this event, to do nothing, ever?
 
A

Allen Browne

Rick, Access 2000 does have the Dirty event.

In some versions the event will not fire if the record is being dirtied
programmatically. The worst case is where assign a value to a bound control
in the form's Current event, because you are dirtying the form as soon as
you move to the record. If you are not doing something like that, the even
should fire when the user makes their first keystroke in a bound control.
And if you are intentionally dirtying the form programmatically, you can
also call the event yourself in that code:
Call Form_Dirty (False)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Rick Roubos said:
That article worked very well for me using Access 97 and 2000 but can't
work
with 2003. And the Dirty event is not firing for some reason.

I was hoping there was a solution that could work in both the 2000 and
2003
environments. It looks as if the workstations will have to revert to the
older version for now.

Allen Browne said:
That article has never worked reliably, so it is not surprising that you
have run into problems after converting.

Forms now have a Dirty event and an Undo event. Use the Dirty event to
determine when the form is being dirtied.

Rick Roubos said:
Background:
I've written an application that is running on a few machines. The majority
of the machines have Access 2000 installed with the remainder using Access
2003.


I used the Microsoft suggested method (method 2 of the Knowledge Base
Article
http://support.microsoft.com/default.aspx?scid=kb;en-us;210334&Product=acc)
to detect when a form is being edited based on the [Form].[Dirty]
value. I
use it to control save, undo and various other buttons.

Everything works fine in Access 2000 but it does not work in Access 2003.
When I open the application (still in Access 2000 format) in Access
2003 and
look at the textbox with the control source =[Form].[Dirty] &
EditModeChange([Form]) during a run it shows #Name. I changed the control
source to =[Form].[Dirty] and it gave the same value. This value is
not
allowed on forms in 2003? Any alternate value I can use?


As an aside, the form's OnDirty event does not fire after a bound
control
on
a bound form has changed, even after focus has moved off of that control.
Is this the standard behaviour for this event, to do nothing, ever?
 
R

Rick Roubos

I know 2000 has the dirty event. I tried to get it to work properly (2000
mde using form_dirty in 2003) but it doesn't appear to be working correctly.
I need to fight with it some more.

The timer workaround would probably work too but that's not exactly elegant
is it? ;-) I also don't look forward to creating code in 25+ forms to get
it to work.

Nothing is being done in code to trigger the dirty event, the user should be
able to edit any of the controls and cause it to fire but it doesn't.

It appears Microsoft has dropped support for [form].[dirty] in the control
source of a text box or changed the syntax (without documenting it) in 2003.
I guess the real question is why?


Allen Browne said:
Rick, Access 2000 does have the Dirty event.

In some versions the event will not fire if the record is being dirtied
programmatically. The worst case is where assign a value to a bound control
in the form's Current event, because you are dirtying the form as soon as
you move to the record. If you are not doing something like that, the even
should fire when the user makes their first keystroke in a bound control.
And if you are intentionally dirtying the form programmatically, you can
also call the event yourself in that code:
Call Form_Dirty (False)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Rick Roubos said:
That article worked very well for me using Access 97 and 2000 but can't
work
with 2003. And the Dirty event is not firing for some reason.

I was hoping there was a solution that could work in both the 2000 and
2003
environments. It looks as if the workstations will have to revert to the
older version for now.

Allen Browne said:
That article has never worked reliably, so it is not surprising that you
have run into problems after converting.

Forms now have a Dirty event and an Undo event. Use the Dirty event to
determine when the form is being dirtied.

Background:
I've written an application that is running on a few machines. The
majority
of the machines have Access 2000 installed with the remainder using Access
2003.


I used the Microsoft suggested method (method 2 of the Knowledge Base
Article
http://support.microsoft.com/default.aspx?scid=kb;en-us;210334&Product=acc)
to detect when a form is being edited based on the [Form].[Dirty]
value.
I
use it to control save, undo and various other buttons.

Everything works fine in Access 2000 but it does not work in Access 2003.
When I open the application (still in Access 2000 format) in Access
2003
and
look at the textbox with the control source =[Form].[Dirty] &
EditModeChange([Form]) during a run it shows #Name. I changed the control
source to =[Form].[Dirty] and it gave the same value. This value is
not
allowed on forms in 2003? Any alternate value I can use?


As an aside, the form's OnDirty event does not fire after a bound control
on
a bound form has changed, even after focus has moved off of that control.
Is this the standard behaviour for this event, to do nothing, ever?
 
R

Rick Roubos

addendum

It appears that the on dirty event fires (debugging in Access 2000) but the
me.dirty value is not true like it should be?

Do you guys have any experience with that?

Allen Browne said:
Rick, Access 2000 does have the Dirty event.

In some versions the event will not fire if the record is being dirtied
programmatically. The worst case is where assign a value to a bound control
in the form's Current event, because you are dirtying the form as soon as
you move to the record. If you are not doing something like that, the even
should fire when the user makes their first keystroke in a bound control.
And if you are intentionally dirtying the form programmatically, you can
also call the event yourself in that code:
Call Form_Dirty (False)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Rick Roubos said:
That article worked very well for me using Access 97 and 2000 but can't
work
with 2003. And the Dirty event is not firing for some reason.

I was hoping there was a solution that could work in both the 2000 and
2003
environments. It looks as if the workstations will have to revert to the
older version for now.

Allen Browne said:
That article has never worked reliably, so it is not surprising that you
have run into problems after converting.

Forms now have a Dirty event and an Undo event. Use the Dirty event to
determine when the form is being dirtied.

Background:
I've written an application that is running on a few machines. The
majority
of the machines have Access 2000 installed with the remainder using Access
2003.


I used the Microsoft suggested method (method 2 of the Knowledge Base
Article
http://support.microsoft.com/default.aspx?scid=kb;en-us;210334&Product=acc)
to detect when a form is being edited based on the [Form].[Dirty]
value.
I
use it to control save, undo and various other buttons.

Everything works fine in Access 2000 but it does not work in Access 2003.
When I open the application (still in Access 2000 format) in Access
2003
and
look at the textbox with the control source =[Form].[Dirty] &
EditModeChange([Form]) during a run it shows #Name. I changed the control
source to =[Form].[Dirty] and it gave the same value. This value is
not
allowed on forms in 2003? Any alternate value I can use?


As an aside, the form's OnDirty event does not fire after a bound control
on
a bound form has changed, even after focus has moved off of that control.
Is this the standard behaviour for this event, to do nothing, ever?
 

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