AfterUpdate event not firing when control is updated via code

  • Thread starter Nicholas Scarpinato
  • Start date
N

Nicholas Scarpinato

I have a text box control on a form which is normally updated by the user.
However, there are instances where a generic code is used in this field, and
I have a button on the form that the user clicks to populate that control
with the generic code. My problem is I have code in that text box control's
AfterUpdate event that does not fire when the text box is updated by the
command button's code. This is the underlying code of the command button (it
pops up a form which updates the field in the main form... this is the code
from that second form):


Private Sub Command24_Click()
DoCmd.SelectObject acForm, "Returns Entry Form"
Forms![Returns Entry Form].[PODField] = "000000/0000#" & Me![Frame5].Value
Forms![Returns Entry Form].[PODField].SetFocus
SendKeys "{ENTER}"
DoCmd.Close acForm, "MiscPOCodes"
End Sub

I've tried selecting the field and doing a SendKeys to it, but that doesn't
seem to work either. I need this to work to help cut down on entry time,
otherwise my users will have to remember these codes and type them in every
time they need them (which is quite often).
 
D

Douglas J. Steele

Simply call the procedure.

Assuming this code is running in the Returns Entry Form, use:

Call PODField_AfterUpdate.

If it's running from some other form, go into the module for the form, and
remove the keyword Private from the declaration for the AfterUpdate event.
Then, use

Call Forms("Returns Entry Form").PODField_AfterUpdate
 
N

Nicholas Scarpinato

As Homer Simpson would say, "D'oh!"

I never even thought about that. Not to mention that the AfterUpdate event
of the field being updated only has one command... to call a function. I'll
just call that function from the second form after I update the field.


Thanks!

Douglas J. Steele said:
Simply call the procedure.

Assuming this code is running in the Returns Entry Form, use:

Call PODField_AfterUpdate.

If it's running from some other form, go into the module for the form, and
remove the keyword Private from the declaration for the AfterUpdate event.
Then, use

Call Forms("Returns Entry Form").PODField_AfterUpdate


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Nicholas Scarpinato said:
I have a text box control on a form which is normally updated by the user.
However, there are instances where a generic code is used in this field,
and
I have a button on the form that the user clicks to populate that control
with the generic code. My problem is I have code in that text box
control's
AfterUpdate event that does not fire when the text box is updated by the
command button's code. This is the underlying code of the command button
(it
pops up a form which updates the field in the main form... this is the
code
from that second form):


Private Sub Command24_Click()
DoCmd.SelectObject acForm, "Returns Entry Form"
Forms![Returns Entry Form].[PODField] = "000000/0000#" & Me![Frame5].Value
Forms![Returns Entry Form].[PODField].SetFocus
SendKeys "{ENTER}"
DoCmd.Close acForm, "MiscPOCodes"
End Sub

I've tried selecting the field and doing a SendKeys to it, but that
doesn't
seem to work either. I need this to work to help cut down on entry time,
otherwise my users will have to remember these codes and type them in
every
time they need them (which is quite often).
 

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

Top