A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Event form_dirty not occurs



 
 
Thread Tools Display Modes
  #1  
Old February 11th, 2005, 05:10 PM
Nhan
external usenet poster
 
Posts: n/a
Default Event form_dirty not occurs

Hi,

I have a form, that is bounded to a table and had form_dirty event
procedure.
But this event doesn't occur at all. Why?
I have checked the property window, Datasource property and event Dirty, all
is OK.

thanks for help
Nhan


  #2  
Old February 11th, 2005, 07:49 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"Nhan" wrote in message

Hi,

I have a form, that is bounded to a table and had form_dirty event
procedure.
But this event doesn't occur at all. Why?
I have checked the property window, Datasource property and event
Dirty, all is OK.

thanks for help
Nhan


The Dirty event won't fire if you have dirtied the form with code, even
if now the form is modified by user action. Could this be the problem?

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

(please reply to the newsgroup)


  #3  
Old February 11th, 2005, 08:02 PM
Nhan
external usenet poster
 
Posts: n/a
Default

even if now the form is modified by user action
What do you mean? Macros? Not by macros

Could this be the problem?

The Form is not changed by code, but by keyboard

I am surprised, that an article in MSDN demonstrates, how we can check and
reag dirty property of a form. Why? Does it mean, that we should not use
Form_dirty event?

ACC2000: How to Automatically Detect If a Form Is Being Edited
Q210334

Method 2: Using the Dirty Property in an Expression
1.. Follow steps 1 through 4 in Method 1.


2.. Add a new text box with the following properties to the form:



Name: txtEditModeChange
ControlSource: =[Form].[Dirty] & EditModeChange([Form])
Visible: No 3.. On the View menu, click Code.


4.. Create the following function in the module, and then close the
module:



Function EditModeChange (F As Form) As Variant

If F.Dirty Then
F!btnUndo.Enabled = True
Else
F!btnUndo.Enabled = False
End If

End Function 5.. Set the form's AfterUpdate property to the following event
procedu



Sub Form_AfterUpdate ()
Me!txtEditModeChange.Requery
End Sub


  #4  
Old February 11th, 2005, 08:17 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"Nhan" wrote in message

even if now the form is modified by user action

What do you mean? Macros? Not by macros

Could this be the problem?

The Form is not changed by code, but by keyboard


Hmm. If the value of a bound control is modified by user action, and
the form is not already dirty, then the Dirty event should fire. If
that's not happening in your case, something peculiar is going on.

I am surprised, that an article in MSDN demonstrates, how we can
check and reag dirty property of a form. Why? Does it mean, that we
should not use Form_dirty event?

ACC2000: How to Automatically Detect If a Form Is Being Edited
Q210334


The Dirty event and the Dirty property aren't quite the same. The Dirty
property is True whenever the form's record has been modified but not
yet saved, no matter how that modification occurred. The Dirty *event*
fires only when a user action (via the user interface) causes the form
to become dirty or when the Text property of a bound control is changed,
when it wasn't dirty before.

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

(please reply to the newsgroup)


  #5  
Old February 11th, 2005, 08:20 PM
Nhan
external usenet poster
 
Posts: n/a
Default

again,
this form worked well, then I changed some code, now the dirty event is not
fired. When I let the recordselector visible, I can see that the record is
changed, when I type a character in a textbox, although dirty event is not
fired.

"Dirk Goldgar" schrieb im Newsbeitrag
...
"Nhan" wrote in message

Hi,

I have a form, that is bounded to a table and had form_dirty event
procedure.
But this event doesn't occur at all. Why?
I have checked the property window, Datasource property and event
Dirty, all is OK.

thanks for help
Nhan


The Dirty event won't fire if you have dirtied the form with code, even
if now the form is modified by user action. Could this be the problem?

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

(please reply to the newsgroup)




  #6  
Old February 11th, 2005, 08:28 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"Nhan" wrote in message

again,
this form worked well, then I changed some code, now the dirty event
is not fired. When I let the recordselector visible, I can see that
the record is changed, when I type a character in a textbox, although
dirty event is not fired.


The obvious question is, what code did you change?

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

(please reply to the newsgroup)


  #7  
Old February 12th, 2005, 08:46 AM
Nhan
external usenet poster
 
Posts: n/a
Default

again,
this form worked well, then I changed some code, now the dirty event
is not fired. When I let the recordselector visible, I can see that
the record is changed, when I type a character in a textbox, although
dirty event is not fired.


The obvious question is, what code did you change?

I have changed and add a lot of code and functions, I can't tell you, what.
But the basic function to deactivate and activate buttons, when form is
dirty, is not changed.

In old version, the dirty event is also fired, when a textbox is set to new
value over VB code.
The scenario:
- on a form there is a combobox for articles, when users type a new value
and choose it , notinlist event is fired.
- then the form article will be opened, and the new value from combox will
be filled in the article name Textbox. Now the Dirty event is fired, that
is, what I desire.



  #8  
Old February 12th, 2005, 09:44 PM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default

Have you checked that the "On Dirty" row of the Form's Properties still have
"[Event Procedure]" in the row?

If it has, put a Break on the Sub declaration and trace it. Make sure you
compile the code first in case there is a Compile error somewhere else that
can affect the entire code.

--
HTH
Van T. Dinh
MVP (Access)


"Nhan" wrote in message
...
I have changed and add a lot of code and functions, I can't tell you,

what.
But the basic function to deactivate and activate buttons, when form is
dirty, is not changed.

In old version, the dirty event is also fired, when a textbox is set to

new
value over VB code.
The scenario:
- on a form there is a combobox for articles, when users type a new value
and choose it , notinlist event is fired.
- then the form article will be opened, and the new value from combox will
be filled in the article name Textbox. Now the Dirty event is fired, that
is, what I desire.





  #9  
Old February 13th, 2005, 02:15 AM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"Nhan" wrote in message


In old version, the dirty event is also fired, when a textbox is set
to new value over VB code.


That should *not* have happened, unless the old code set the text box's
Text property, rather than its Value property. Setting a control's
Value property in code does not raise the form's Dirty event, but
setting its Text property does -- if the form is not yet dirty, that is.

The scenario:
- on a form there is a combobox for articles, when users type a new
value and choose it , notinlist event is fired.
- then the form article will be opened, and the new value from combox
will be filled in the article name Textbox. Now the Dirty event is
fired, that is, what I desire.


If your code is currently like this:

DoCmd.OpenForm "Article"
Forms!Article!ArticleName = Me!cboArticle

Try changing it to be like this:

DoCmd.OpenForm "Article"
With Forms!Article!ArticleName
.SetFocus
.Text = Me!cboArticle
End With

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

(please reply to the newsgroup)


  #10  
Old February 13th, 2005, 03:18 AM
Nhan
external usenet poster
 
Posts: n/a
Default


"Van T. Dinh" schrieb im
Newsbeitrag ...
Have you checked that the "On Dirty" row of the Form's Properties still

have
"[Event Procedure]" in the row?

Yes

If it has, put a Break on the Sub declaration and trace it. Make sure you
compile the code first in case there is a Compile error somewhere else

that
can affect the entire code.


I have done, therefore I knew, that the event is not fired


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Value is Negative Code Problem! Dave Elliott Using Forms 15 November 10th, 2004 01:29 PM
Which event occurs when a textbox is changed programmatically? Kamil Dursun Using Forms 6 August 11th, 2004 12:43 AM
Need help with Access decision aualias General Discussion 23 June 21st, 2004 02:04 AM
MsiInstaller Events on a Win2000 Terminal Server jwgoerlich Setup, Installing & Configuration 0 May 26th, 2004 06:30 PM


All times are GMT +1. The time now is 07:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.