"(PeteCresswell)" <x@y.Invalid> wrote in
news:f68262do7o5tfkugkdht1ka6bnurohgdsh@4ax.com:
[color=blue]
> Per David W. Fenton:[color=green]
>>How can you do without the events, and the .Dirty property?[/color]
>
> I use events extensively.[/color]
Not the built-in record events, since they don't fire in an unbound
form (e.g., OnCurrent, BeforeUpdate, BeforeInsert, etc.). You have
to recreate them in some form if you need them, and that is a real
pain, since there is often no single place to call them from, as
your example of replacing the Dirty property shows perfectly.
[color=blue]
> Maybe I'm just not using it properly, but I find that .Dirty gets
> too complicated with, say, a half-dozen subforms.
>
> Instead, I code a .MakeDirty function in the parent form and call
> it from the child forms whenever something changes.
>
> e.g.
> ---------------------------------------------
> Private Sub cboWhatever_AfterUpdate
> afterUpdateAllFields
> End Sub
>
> Private Sub afterUpdateAllFields
> With me
> .Parent.MakeDirty .Name
> End With
> End Sub
>
> Public Sub MakeDirty(ByVal theFormName As String)
> Select Case theFormName
> frmOne
> mDirty_FormOne = True
> frmTwo
> mDirty_FormTwo = true
> frmThree
> mDirty_FormThree = true
> end select
>
> with me
> .cmdClose.Caption = "Cancel"
> .cmdSave.Enabled = true
> end with
> End Sub
> ---------------------------------------------
>
>
> That way I even have the option of keeping track of which children
> have been changed. Also .MakeDirty can manage the .Enabled
> status/captions of the "Save" and "Cancel/Close" buttons.[/color]
Why couldn't the built-in OnDirty event do the same thing? The
OnDirty event for the parent form wouldn't affect the Dirty
properties of the child forms (or vice versa, except for a new
record).
I've done all of this myself, and see no advantage whatsoever to
recoding all of this when it's all available in a bound form without
any coding. Of course, I also have never even contemplated an
unbound form with unbound subforms. That just strikes me as complete
insanity, sorry.
--
David W. Fenton
http://www.dfenton.com/
usenet at dfenton dot com
http://www.dfenton.com/DFA/