Multiple After Update Event Procedures

E

eklahorst

Hello, I have created a form in Access 2003. On this form is based upon a
query that has Department, Department Supervisor, Description, and then also
has profile number, list number. I have created an after update event that
will fill in the Department Supervisor after they select Department from the
department combo box. My question is it possible to have another after
update event happen that will fill the profile number and list number when
they select the description from another combo box? If so - how would I do
this? I created another after update event for the description but when I
select a description nothing fills in the text boxes for profile number and
list number. My code looks like this:

Private Sub Affected_Call_List_Description_AfterUpdate()

Me.Affected_Load_Profile = Me.Affected_Call_List_Description.Column(2)

End Sub


Private Sub Department_AfterUpdate()

Me.Department_Supervisor = Me.Department.Column(1)

End Sub
 
R

Rick Brandt

eklahorst said:
Hello, I have created a form in Access 2003. On this form is based
upon a query that has Department, Department Supervisor, Description,
and then also has profile number, list number. I have created an
after update event that will fill in the Department Supervisor after
they select Department from the department combo box. My question is
it possible to have another after update event happen that will fill
the profile number and list number when they select the description
from another combo box? If so - how would I do this? I created
another after update event for the description but when I select a
description nothing fills in the text boxes for profile number and
list number. My code looks like this:

Private Sub Affected_Call_List_Description_AfterUpdate()

Me.Affected_Load_Profile = Me.Affected_Call_List_Description.Column(2)

End Sub

First off, there is nothing here that even attempts to set list number. If you
have only one line setting the profile control how would you expect this to also
set the value of the list number control? Most likely you need something
like...

Private Sub Affected_Call_List_Description_AfterUpdate()
Me.Affected_Load_Profile = Me.Affected_Call_List_Description.Column(2)
Me.Affected_List_Number = Me.Affected_Call_List_Description.Column(3)
End Sub

Second, does the Affected_Call_List_Description ListBox actually contain the
additional columns that you need to reference? In the one line you have you are
referencing the third column of the ListBox. Does it have a third column? If
so, does that column contain the data you want?

Third, in most cases copying data like this is the incorrect way to build a
database. You should only need to copy the Primary Key field into related
tables and then you use the realtionship to "look up" the other values rather
than copying those value over and over.
 
B

Baz

Did you create the second procedure by copying/pasting the first one and
then editing it?

Open the Properties sheet for the Affected_Call_List_Description control,
click the Event tab, and make sure that [Event Procedure] is selected
against "After Update". If it doesn't say [Event Procedure], then the
procedure will not run.
 
E

eklahorst

No I did not, I created both from scratch. Yes they both say after update.
Did you create the second procedure by copying/pasting the first one and
then editing it?

Open the Properties sheet for the Affected_Call_List_Description control,
click the Event tab, and make sure that [Event Procedure] is selected
against "After Update". If it doesn't say [Event Procedure], then the
procedure will not run.
Hello, I have created a form in Access 2003. On this form is based upon a
query that has Department, Department Supervisor, Description, and then also
[quoted text clipped - 18 lines]
 
E

eklahorst

I understand list number was not included, I was just trying to make sure
that load profile worked first. Yes the affected list box contains all load
profile and list ID and they are in the appropriate columns. The reason I am
having the form contain this information is because it will be emailed to
another department that does not have access to this database.

Rick said:
Hello, I have created a form in Access 2003. On this form is based
upon a query that has Department, Department Supervisor, Description,
[quoted text clipped - 13 lines]

First off, there is nothing here that even attempts to set list number. If you
have only one line setting the profile control how would you expect this to also
set the value of the list number control? Most likely you need something
like...

Private Sub Affected_Call_List_Description_AfterUpdate()
Me.Affected_Load_Profile = Me.Affected_Call_List_Description.Column(2)
Me.Affected_List_Number = Me.Affected_Call_List_Description.Column(3)
End Sub

Second, does the Affected_Call_List_Description ListBox actually contain the
additional columns that you need to reference? In the one line you have you are
referencing the third column of the ListBox. Does it have a third column? If
so, does that column contain the data you want?

Third, in most cases copying data like this is the incorrect way to build a
database. You should only need to copy the Primary Key field into related
tables and then you use the realtionship to "look up" the other values rather
than copying those value over and over.
 
R

Rick Brandt

eklahorst said:
I understand list number was not included, I was just trying to make
sure that load profile worked first. Yes the affected list box
contains all load profile and list ID and they are in the appropriate
columns. The reason I am having the form contain this information is
because it will be emailed to another department that does not have
access to this database.

That is not a valid reason. You can use a query, form, or report that uses the
data from both tables and is therefore capable of having all of the data you
require without copying it.

At any rate if...

Me.Affected_Load_Profile = Me.Affected_Call_List_Description.Column(2)

....does not result in a value showing up in Affected_Load_Profile, then that
indicates that Me.Affected_Call_List_Description.Column(2) does not contain any
data. You do know that the column numbers start with zero right? Column(2)
would actually be the third column in the ListBox.
 
E

eklahorst

Yes I am aware that they start in zero. The layout is Call List Description,
Client, Load Profile, List Number.
 
R

Rick Brandt

eklahorst said:
Yes I am aware that they start in zero. The layout is Call List
Description, Client, Load Profile, List Number.

Can you actually see all of these columns in your ListBox?
 

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