472,139 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,139 software developers and data experts.

Me.Dirty - Please help.

16
Please Help - If Me.Dirty
I Understood That It Check If any Data in controls had changed.
I Have a Form with few textboxes, and On Exit from the form i want to check if data was changed. But It didn't work, Me.Dirty returned "false" although I changed data in textbox.
the real reason, I understand now, it because the textboxes are in subform and the Exit button is at the main form, so me.dirty don't recognize changes in the subform.
What can I do
Mar 6 '07 #1
5 19757
ADezii
8,830 Expert 8TB
Please Help - If Me.Dirty
I Understood That It Check If any Data in controls had changed.
I Have a Form with few textboxes, and On Exit from the form i want to check if data was changed. But It didn't work, Me.Dirty returned "false" although I changed data in textbox.
the real reason, I understand now, it because the textboxes are in subform and the Exit button is at the main form, so me.dirty don't recognize changes in the subform.
What can I do
Declare the following Public Variable in a Standard Module:
Expand|Select|Wrap|Line Numbers
  1. Public blnDataChangedInSubForm As Boolean
In the Dirty() Event of your Sub-Form:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Dirty(Cancel As Integer)
  2.   blnDataChangedInSubForm = True
  3. End Sub
In the Close() Event of your Main Form:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Close()
  2. If blnDataChangedInSubForm Then
  3.   MsgBox "Data has changed in the Sub-Form"
  4.   'Do other processing here if desired
  5. Else
  6.   MsgBox "Data has not changed in the Sub-Form"
  7.   'Do other processing here if desired
  8. End If
  9. End Sub
Mar 6 '07 #2
NeoPa
32,498 Expert Mod 16PB
You can also refer directly to the Dirty property of the subform (Referring to Items on a Sub-Form) :
Expand|Select|Wrap|Line Numbers
  1. If Me![SubformName].Form.Dirty Then
Mar 7 '07 #3
DanielM
16
Thanks a lot to both of you.
I will try .
Mar 7 '07 #4
DanielM
16
Hello Neopa,
I tried your suggestion, but it still returned 'false' although I made a change in a textbox. I wrote:
If Me.cldCustomer.Form.Dirty Then
(cldCustomer is the Name of The Child. The Name of the form in this child, he didn't recognize).
Please help.
Mar 7 '07 #5
NeoPa
32,498 Expert Mod 16PB
Hello Neopa,
I tried your suggestion, but it still returned 'false' although I made a change in a textbox. I wrote:
If Me.cldCustomer.Form.Dirty Then
(cldCustomer is the Name of The Child. The Name of the form in this child, he didn't recognize).
Please help.
Is the CheckBox bound to the underlying Record Source?
I think it would need to be to set the Dirty property.
Mar 7 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Sean C. | last post: by
1 post views Thread by RIP662 | last post: by
9 posts views Thread by Susan Bricker | last post: by
5 posts views Thread by Alain Filiatrault | last post: by
5 posts views Thread by Nmx | last post: by
reply views Thread by yp.yean | last post: by
3 posts views Thread by dkintheuk | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.