locked
"Property not found" error for Me.Dirty RRS feed

  • Question

  • Debugging a procedure to trace an error, got to this code and received an error "Property not found" (error number 3270). Yet in immediate window it shows Me.Dirty to be True. I used to have On Error Resume Next at the top of this routine (not sure why) and got this ereor after I changed it to as below. Any ideas?

    Private Sub butClose_Click()
       On Error GoTo ER
       If Me.Dirty Then
          Me.Dirty = False

    Thursday, January 17, 2013 8:44 PM

Answers

  • I think I figured out what is happening, though why still eludes me. The statement: If Me.Dirty triggers Form_BeforeUpdate. In Form_BeforeUpdate the update must be being cancelled, hence when I exit, Me.Dirty is still true, so the next statement Me.Dirty = False is invalid because Me.Dirty must be true at this point. Does this make sense or am I having hallucinations (it is late in the day here)? The error occurs on Me.Dirty = False and is "The setting you entered isn't valid for this property".
    Friday, January 18, 2013 12:52 AM
  • This link has some odd findings concerning the Dirty event.  I'm not sure if there's anything there that applies to this situation, but maybe it'll help make the pieces fit.

    http://www.utteraccess.com/wiki/index.php?title=Form_Event_Quirks

    Cheers


    Jack D. Leach (Access MVP)
    UtterAccess Wiki: (Articles, Functions, Classes, VB7 API Declarations and more)

    • Proposed as answer by Dummy yoyo Tuesday, January 22, 2013 8:00 AM
    • Marked as answer by Dummy yoyo Wednesday, January 23, 2013 10:45 AM
    Friday, January 18, 2013 2:14 AM

All replies

  • For the record, you may not need this: Access will save any pending changes automatically when the form is closed.

    Jack D. Leach (Access MVP)
    UtterAccess Wiki: (Articles, Functions, Classes, VB7 API Declarations and more)

    Thursday, January 17, 2013 9:10 PM
  • I'm aware of that but I need to force the Form_BeforeUpdate event at certain points because that is where all my validations are located and depending on the results of those validations and the response to certain message boxes, I may allow the user to save or not save the updates.
    Thursday, January 17, 2013 9:52 PM
  • I have seen other weird things happen when debugging, for which I have no explanation. However, I do have a suggestion regarding your validation. Move all of your validation code to a separate procedure and call it from anywhere that you like, including Before_Update.
    Thursday, January 17, 2013 10:23 PM
  • I think I figured out what is happening, though why still eludes me. The statement: If Me.Dirty triggers Form_BeforeUpdate. In Form_BeforeUpdate the update must be being cancelled, hence when I exit, Me.Dirty is still true, so the next statement Me.Dirty = False is invalid because Me.Dirty must be true at this point. Does this make sense or am I having hallucinations (it is late in the day here)? The error occurs on Me.Dirty = False and is "The setting you entered isn't valid for this property".
    Friday, January 18, 2013 12:52 AM
  • This link has some odd findings concerning the Dirty event.  I'm not sure if there's anything there that applies to this situation, but maybe it'll help make the pieces fit.

    http://www.utteraccess.com/wiki/index.php?title=Form_Event_Quirks

    Cheers


    Jack D. Leach (Access MVP)
    UtterAccess Wiki: (Articles, Functions, Classes, VB7 API Declarations and more)

    • Proposed as answer by Dummy yoyo Tuesday, January 22, 2013 8:00 AM
    • Marked as answer by Dummy yoyo Wednesday, January 23, 2013 10:45 AM
    Friday, January 18, 2013 2:14 AM
  • Thanks for that link, it was exactly what I needed !
    Tuesday, January 22, 2013 6:38 PM