From: BruceM via AccessMonster.com on
ARe you placing the code in the correct form's Before Update event? If the
HH field in question is in the subform, that is where the Before Update code
needs to be.

Place the following in the Before Update code of the form and the subform:

MsgBox Me.Name & " is updating"

I too find it hard to believe the Before Update event is not running when you
update a record. If it truly is not, try creating a new form. You can use
autoform, or otherwise make a quick and simple form, and test the Before
Update event there.

Lau wrote:
>Yes, I use the default built-in navigation buttons. Also, I update records
>and page back-and-forth, but still it just goes through one record to another
>like there is no BeforeUpdate event. As you can see, I even put the
>statement
>
>MsgBox ("Testing - You are dandy!"), vbOKOnly
>
>to test for condition that meets the criteria. Nothing happens. I find it
>hard to believe myself.
>
>Thank you.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201004/1

From: Jeanette Cunningham on
Here is an issue with your code:

****************
OnDirty event
****************
Private Sub Form_Dirty(Cancel As Integer)
If Me.Dirty = True Then
Me.Dirty = False
End If
End Sub



This code:
If Me.Dirty = True Then
Me.Dirty = False
End If

Goes in the form's before update event.
It will not work for you when you put it in the Dirty event.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



"Lau via AccessMonster.com" <u46349(a)uwe> wrote in message
news:a693e08d9fd2a(a)uwe...
> Yes, I use the default built-in navigation buttons. Also, I update
> records
> and page back-and-forth, but still it just goes through one record to
> another
> like there is no BeforeUpdate event. As you can see, I even put the
> statement
>
> MsgBox ("Testing - You are dandy!"), vbOKOnly
>
> to test for condition that meets the criteria. Nothing happens. I find
> it
> hard to believe myself.
>
> Thank you.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201004/1
>


From: Marshall Barton on
Jeanette Cunningham wrote:

>Here is an issue with your code:
>
>****************
>OnDirty event
>****************
>Private Sub Form_Dirty(Cancel As Integer)
> If Me.Dirty = True Then
> Me.Dirty = False
> End If
>End Sub
>
>This code:
>If Me.Dirty = True Then
> Me.Dirty = False
> End If
>
>Goes in the form's before update event.
>It will not work for you when you put it in the Dirty event.


But, but, but the form's BeforeUpdate event will not be
triggered unless the form is dirty, so dirty is guaranteed
to be true. I.e. that code in the form's BeforeUpdate event
is redundant and can be omitted.

--
Marsh
MVP [MS Access]
From: Lau via AccessMonster.com on
Because I do not have a customed Close button, I removed OnDirty event. Then
I put BeforeUpdate event codes on the subform and at the same time I
discovered a mistake in Dcount statement. Notice I had the part "Me!
sbf_family!" inside the quotation in second part of the condition below.

If DCount("[household_id]", "tbl_family", "[household_id] = " & Me!sbf_family!
household_id & " AND Me!sbf_family!relationship_id = 'AA'") > 0 Then

I should have had this.

If DCount("[household_id]", "tbl_family", "[household_id] = " & Me!
household_id & " AND relationship_id = 'AA'") > 0 Then

Now it's triggering the BeforeUpdate event, but it happens to every family
member. I only want to check for Head of HH when I go to another family.

Thanks.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201004/1

From: Lau via AccessMonster.com on
In the relationship field of the subform, I have an OnChange event to reset
all family members' relationship when a new family member is set to Head of
HH.

Thanks.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201004/1