Problem with After_Update event

  • Thread starter Thread starter Laurel
  • Start date Start date
L

Laurel

I have text box with code in the after_update event. The code is very
simple

[txtWeekDay] = "Testing this event"

My problem is that if the form is set to AllowAdditions = False, then
after_update doesn't execute UNLESS I put a break point in it. Then it does
execute. So..... I'm not positive that it doesn't execute, but I'm positive
that txtWeekDay doesn't get set unless the form is set to AllowAdditions =
True.

Any suggestions? (Other than setting AllowAdditions to true, which I don't
want to to at this point.)
 
Laurel,
I'm not sure what you mean...
doesn't execute UNLESS I put a break point in it.
You can programatically remove and reinstall AllowAdditions.
Me.AllowAdditions = True
[txtWeekDay] = "Testing this event"
Me.AllowAdditions = False
 
I have been programatticaly setting it and unsetting it, as well as setting
it in the form. Either method produces the same results, but
progromatically setting it to true to solve this problem, becaue it creates
that empty row that I don't want.

It's probably hard to understand because, literally, I mean that if the form
is set to AllowAdditions = false, the code below does not execute
(txtWeekDay doesn't get set to "Testing this event."

BUT - Without changing anything else. If I put a breakpoint on [txtWeekDay]
= "Testing this event," then txtWeekDay DOES get set.

I've also tried using the Exit event. Same behavior.

Al Camp said:
Laurel,
I'm not sure what you mean...
doesn't execute UNLESS I put a break point in it.
You can programatically remove and reinstall AllowAdditions.
Me.AllowAdditions = True
[txtWeekDay] = "Testing this event"
Me.AllowAdditions = False
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Laurel said:
I have text box with code in the after_update event. The code is very
simple

then after_update doesn't execute UNLESS I put a break point in it. Then
it does execute. So..... I'm not positive that it doesn't execute, but
I'm positive that txtWeekDay doesn't get set unless the form is set to
AllowAdditions = True.

Any suggestions? (Other than setting AllowAdditions to true, which I
don't want to to at this point.)
 
Do you have a contiuous form where you set AllowAdditions = False so you
won't see a new record line?
Is the field with your AfterUpdate code on an existing record?
What are you trying to do, and what are you doing to trigger the AfterUpdate
event... explain in detail.

"Programatically" updating the value of a field does not trigger the
AfterUpdate event. You have to "call" the AfterUpdate event in that code if
you want AfterUpdate to trigger.

A field in an existing record with AllowEdits/Additions/Deletes set to NO
can still be programatically updated.
Even if the field is set to Disable/Locked... it can still be
programatically updated.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Laurel said:
I have been programatticaly setting it and unsetting it, as well as setting
it in the form. Either method produces the same results, but
progromatically setting it to true to solve this problem, becaue it creates
that empty row that I don't want.

It's probably hard to understand because, literally, I mean that if the
form is set to AllowAdditions = false, the code below does not execute
(txtWeekDay doesn't get set to "Testing this event."

BUT - Without changing anything else. If I put a breakpoint on
[txtWeekDay] = "Testing this event," then txtWeekDay DOES get set.

I've also tried using the Exit event. Same behavior.

Al Camp said:
Laurel,
I'm not sure what you mean...
doesn't execute UNLESS I put a break point in it.
You can programatically remove and reinstall AllowAdditions.
Me.AllowAdditions = True
[txtWeekDay] = "Testing this event"
Me.AllowAdditions = False
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Laurel said:
I have text box with code in the after_update event. The code is very
simple

My problem is that if the form is set to AllowAdditions = False,
then after_update doesn't execute UNLESS I put a break point in it.
Then it does execute. So..... I'm not positive that it doesn't execute,
but I'm positive that txtWeekDay doesn't get set unless the form is set
to AllowAdditions = True.

Any suggestions? (Other than setting AllowAdditions to true, which I
don't want to to at this point.)
 
Al Camp said:
Do you have a contiuous form where you set AllowAdditions = False so you
won't see a new record line? Yes

Is the field with your AfterUpdate code on an existing record?

No, it's an unbound text box
What are you trying to do, and what are you doing to trigger the
AfterUpdate event... explain in detail.

The field in question is a date field. It is part of the criteria for the
retrieval of the rows in the form. I don't want to see an empty row before
the person enters the retrieval value. The after_update is triggered (or
should be triggered....) when someone puts data in that unbound text box and
then leaves it. The code in After_Update normally just executes a function
that puts the name of the day of the week in another text box. If
AllowAdditions is false, the name of the week doesn't get assigned when the
person tabs or clicks off of the date box. If it is true OR.... if I put a
break in after_update with the debugger, then the name-of-the-day field
gets assigned properly.
"Programatically" updating the value of a field does not trigger the
AfterUpdate event. You have to "call" the AfterUpdate event in that code
if you want AfterUpdate to trigger.

No, I wasn't progromatically setting the value of the field. I was doing
this...
Call txtScore_Date_AfterUpdate in the activate event. This was so the
day name would display based on the default value of the date unbound text
box.
So - txtScore_Date_AfterUpdate should have been executed in two ways
1 - By code in the Activate event
2 - Whenever the user entered data in txtScore_Date

In both instances, whatever code I happened to have in the
txtScore_Date_AfterUpdate event only executed (or only appeared to execute)
if the form was set to AllowAdditions = true. This was true whether I put
a statement to that effect in code, or whether I set the value in
Properties.

A field in an existing record with AllowEdits/Additions/Deletes set to NO
can still be programatically updated.
Even if the field is set to Disable/Locked... it can still be
programatically updated.

Yeah, but by now I hope it will be clear that is not the issue.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Laurel said:
I have been programatticaly setting it and unsetting it, as well as
setting it in the form. Either method produces the same results, but
progromatically setting it to true to solve this problem, becaue it
creates that empty row that I don't want.

It's probably hard to understand because, literally, I mean that if the
form is set to AllowAdditions = false, the code below does not execute
(txtWeekDay doesn't get set to "Testing this event."

BUT - Without changing anything else. If I put a breakpoint on
[txtWeekDay] = "Testing this event," then txtWeekDay DOES get set.

I've also tried using the Exit event. Same behavior.

Al Camp said:
Laurel,
I'm not sure what you mean...
doesn't execute UNLESS I put a break point in it.
You can programatically remove and reinstall AllowAdditions.
Me.AllowAdditions = True
[txtWeekDay] = "Testing this event"
Me.AllowAdditions = False
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


I have text box with code in the after_update event. The code is very
simple

My problem is that if the form is set to AllowAdditions = False,
then after_update doesn't execute UNLESS I put a break point in it.
Then it does execute. So..... I'm not positive that it doesn't
execute, but I'm positive that txtWeekDay doesn't get set unless the
form is set to AllowAdditions = True.

Any suggestions? (Other than setting AllowAdditions to true, which I
don't want to to at this point.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top