views:

1017

answers:

3

I'm doing some development in access and I'm running into an issue where I need to make sure that a form is updated in a buttons OnClick handler.

I was thinking that it might work something like this:

if me.dirty then
    me.update     'This is a nonexistent form method'
end if
<rest of handler>

If such a thing exists, will I have to call the OnUpdate Event handler manually?

+2  A: 

How about:

if me.dirty then
    me.dirty=false 
end if

Code as per Allen Browne, MVP:

http://allenbrowne.com/bug-01.html

Remou
A: 

I always use this code in my Save_Click handlers

If Me.Dirty Then    
  DoCmd.RunCommand acCmdSaveRecord   
End If
DJ
+1  A: 

I would avoid the .RunCommand version because there are cases where Me.Dirty = False will work and access to the menu commands is prevented.

On the other hand, Me.Dirty has always struck me as a property that ought to be read-only, but it's not.

David-W-Fenton