RE: BeforeUpdate event is not working

alicejwz

Registered User.
Local time
Today, 23:40
Joined
Jul 9, 2003
Messages
91
RE: BeforeUpdate event is not working

Good Morning,

Can anyone think of why BeforeUpdate event is not working?
I have a check box in a subform when clicks it executed BeforeUpdate event but sees the check box is true. Why?
I tested with another form the BeforeUpdate event works in check box. There is Afterupdate event for the check box in a subform but that should not be the problem.
This is my code in subform:

Private Sub quick_sort_BeforeUpdate(Cancel As Integer)
If Me!quick_sort.Value = True Then
Me!prev_dispo.Value = "Quick-Sort"
else
Me!prev_dispo.Value = ""
end if
end sub

I just can't understand why this is not working.
Thanks for your input.
 
Hi there,

For check boxes it's ususally enough to put:

If [quick sort] Then

and not have to put .value or anything like that.

Also is the field "prev_dispo" on the subform or the main form? If it's on the main form then you'll need to refer to it in the code as follows:

Forms!FormName!FieldName.Value =

Also for the Else part of the code, it's better to put:

Me.prev_dispo.value = Null

and NOT

Me.prev_dispo.value = ""


Apart from that it might be an idea to zip the database and attach it so we can have a look.

Rusty
:D
 
Last edited:
Because the BeforeUpdate() event is used to validate entries (at control or form level) and not for assignation of controls. Use the AfterUpdate event.

Other things:

  • use early binding: i.e. Me. not Me!
  • learn to use prefixes for your object names. i.e. txt for textbox, cbo for combobox
  • Don't use underscores in object names i.e. txtQuickSort
 

Users who are viewing this thread

Back
Top Bottom