ItemData

  • Thread starter Thread starter Lana
  • Start date Start date
L

Lana

Hi all,

I want my combo37 to offer me values as follows (every time only 3 rows, but
values depend on what i choose from other 2 combos: combo21 & ToPerson1)

Me.Combo37.[ItemData](0) = Me.ToPerson1.Column(4)
Me.Combo37.[ItemData](1) = Me.ToPerson1.Column(5)
Me.Combo37.[ItemData](2) = Me.Combo21.Column(3) + Me.Combo21.Column(4) +
Me.Combo21.Column(5)

I have placed this code on AfterUpdate event of Combo ToPerson1. (which is
re-queried each time when Combo21 is updated)


However i was probably wrong as i get a message "run-time error 424: Object
Required" when trying to update the Combo ToPerson1.


Can anybody give me a hint where i was wrong, please?

Thank you.
Lana
 
Hi Lana,
try moving this code to the Enter event for combo37
With the code you have, there will be an error if combo21 is empty when the
after update for ToPerson1 runs.

Jeanette Cunningham
 
Hi Jeanette ,

I tried to do as you suggest, but i still keep getting the same error
message "run-time error 424: Object Required" - but now it appears when i try
to update the Combo37.

Lana


Jeanette Cunningham said:
Hi Lana,
try moving this code to the Enter event for combo37
With the code you have, there will be an error if combo21 is empty when the
after update for ToPerson1 runs.

Jeanette Cunningham

Lana said:
Hi all,

I want my combo37 to offer me values as follows (every time only 3 rows,
but
values depend on what i choose from other 2 combos: combo21 & ToPerson1)

Me.Combo37.[ItemData](0) = Me.ToPerson1.Column(4)
Me.Combo37.[ItemData](1) = Me.ToPerson1.Column(5)
Me.Combo37.[ItemData](2) = Me.Combo21.Column(3) + Me.Combo21.Column(4) +
Me.Combo21.Column(5)

I have placed this code on AfterUpdate event of Combo ToPerson1. (which is
re-queried each time when Combo21 is updated)


However i was probably wrong as i get a message "run-time error 424:
Object
Required" when trying to update the Combo ToPerson1.


Can anybody give me a hint where i was wrong, please?

Thank you.
Lana
 
Lana, I have to go now, if no one else has answered by tomorrow, I will post
back.

Jeanette Cunningham


Lana said:
Hi Jeanette ,

I tried to do as you suggest, but i still keep getting the same error
message "run-time error 424: Object Required" - but now it appears when i
try
to update the Combo37.

Lana


Jeanette Cunningham said:
Hi Lana,
try moving this code to the Enter event for combo37
With the code you have, there will be an error if combo21 is empty when
the
after update for ToPerson1 runs.

Jeanette Cunningham

Lana said:
Hi all,

I want my combo37 to offer me values as follows (every time only 3
rows,
but
values depend on what i choose from other 2 combos: combo21 &
ToPerson1)

Me.Combo37.[ItemData](0) = Me.ToPerson1.Column(4)
Me.Combo37.[ItemData](1) = Me.ToPerson1.Column(5)
Me.Combo37.[ItemData](2) = Me.Combo21.Column(3) +
Me.Combo21.Column(4) +
Me.Combo21.Column(5)

I have placed this code on AfterUpdate event of Combo ToPerson1. (which
is
re-queried each time when Combo21 is updated)


However i was probably wrong as i get a message "run-time error 424:
Object
Required" when trying to update the Combo ToPerson1.


Can anybody give me a hint where i was wrong, please?

Thank you.
Lana
 
As far as I'm aware, the ItemData collection is read-only: you cannot set
values in the way you're trying.

Instead, try:

Me.Combo37.RowSource = vbNullString
Me.Combo37.RowSourceType = "Value List"
Me.Combo37.AddItem Me.ToPerson1.Column(4)
Me.Combo37.AddItem Me.ToPerson1.Column(5)
Me.Combo37.AddItem Me.Combo21.Column(3) + Me.Combo21.Column(4) +
Me.Combo21.Column(5)
 
Hi Douglas!

Thank you so much!
I tried your suggestion and it worked - i can see the data and can choose
what i want, but there is 1 problem: when i exit the combo37 i get the
"run-time error 94: Invalid use of Null".....

could this be because of some of the data in Me.ToPerson1.Column(5) or
Me.ToPerson1.Column(4) is missing? how to fix it?

Many thanx!
Lana


Douglas J. Steele said:
As far as I'm aware, the ItemData collection is read-only: you cannot set
values in the way you're trying.

Instead, try:

Me.Combo37.RowSource = vbNullString
Me.Combo37.RowSourceType = "Value List"
Me.Combo37.AddItem Me.ToPerson1.Column(4)
Me.Combo37.AddItem Me.ToPerson1.Column(5)
Me.Combo37.AddItem Me.Combo21.Column(3) + Me.Combo21.Column(4) +
Me.Combo21.Column(5)


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Lana said:
Hi all,

I want my combo37 to offer me values as follows (every time only 3 rows,
but
values depend on what i choose from other 2 combos: combo21 & ToPerson1)

Me.Combo37.[ItemData](0) = Me.ToPerson1.Column(4)
Me.Combo37.[ItemData](1) = Me.ToPerson1.Column(5)
Me.Combo37.[ItemData](2) = Me.Combo21.Column(3) + Me.Combo21.Column(4) +
Me.Combo21.Column(5)

I have placed this code on AfterUpdate event of Combo ToPerson1. (which is
re-queried each time when Combo21 is updated)


However i was probably wrong as i get a message "run-time error 424:
Object
Required" when trying to update the Combo ToPerson1.


Can anybody give me a hint where i was wrong, please?

Thank you.
Lana
 
Lana,

If Not IsNull(Me.ToPerson1.Column(4) then
Me.Combo37.AddItem Me.ToPerson1.Column(4)
End If

If Not IsNull(Me.ToPerson1.Column(5) then
Me.Combo37.AddItem Me.ToPerson1.Column(5)
End If


If Not IsNull(Me.Combo21) then
Me.Combo37.AddItem Me.Combo21.Column(3) + Me.Combo21.Column(4) +
Me.Combo21.Column(5)
End If

Jeanette Cunningham



Lana said:
Hi Douglas!

Thank you so much!
I tried your suggestion and it worked - i can see the data and can choose
what i want, but there is 1 problem: when i exit the combo37 i get the
"run-time error 94: Invalid use of Null".....

could this be because of some of the data in Me.ToPerson1.Column(5) or
Me.ToPerson1.Column(4) is missing? how to fix it?

Many thanx!
Lana


Douglas J. Steele said:
As far as I'm aware, the ItemData collection is read-only: you cannot set
values in the way you're trying.

Instead, try:

Me.Combo37.RowSource = vbNullString
Me.Combo37.RowSourceType = "Value List"
Me.Combo37.AddItem Me.ToPerson1.Column(4)
Me.Combo37.AddItem Me.ToPerson1.Column(5)
Me.Combo37.AddItem Me.Combo21.Column(3) + Me.Combo21.Column(4) +
Me.Combo21.Column(5)


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Lana said:
Hi all,

I want my combo37 to offer me values as follows (every time only 3
rows,
but
values depend on what i choose from other 2 combos: combo21 &
ToPerson1)

Me.Combo37.[ItemData](0) = Me.ToPerson1.Column(4)
Me.Combo37.[ItemData](1) = Me.ToPerson1.Column(5)
Me.Combo37.[ItemData](2) = Me.Combo21.Column(3) +
Me.Combo21.Column(4) +
Me.Combo21.Column(5)

I have placed this code on AfterUpdate event of Combo ToPerson1. (which
is
re-queried each time when Combo21 is updated)


However i was probably wrong as i get a message "run-time error 424:
Object
Required" when trying to update the Combo ToPerson1.


Can anybody give me a hint where i was wrong, please?

Thank you.
Lana
 
Thank you SO MUCH Jeanette !!!
It worked!!!
Lana


Jeanette Cunningham said:
Lana,

If Not IsNull(Me.ToPerson1.Column(4) then
Me.Combo37.AddItem Me.ToPerson1.Column(4)
End If

If Not IsNull(Me.ToPerson1.Column(5) then
Me.Combo37.AddItem Me.ToPerson1.Column(5)
End If


If Not IsNull(Me.Combo21) then
Me.Combo37.AddItem Me.Combo21.Column(3) + Me.Combo21.Column(4) +
Me.Combo21.Column(5)
End If

Jeanette Cunningham



Lana said:
Hi Douglas!

Thank you so much!
I tried your suggestion and it worked - i can see the data and can choose
what i want, but there is 1 problem: when i exit the combo37 i get the
"run-time error 94: Invalid use of Null".....

could this be because of some of the data in Me.ToPerson1.Column(5) or
Me.ToPerson1.Column(4) is missing? how to fix it?

Many thanx!
Lana


Douglas J. Steele said:
As far as I'm aware, the ItemData collection is read-only: you cannot set
values in the way you're trying.

Instead, try:

Me.Combo37.RowSource = vbNullString
Me.Combo37.RowSourceType = "Value List"
Me.Combo37.AddItem Me.ToPerson1.Column(4)
Me.Combo37.AddItem Me.ToPerson1.Column(5)
Me.Combo37.AddItem Me.Combo21.Column(3) + Me.Combo21.Column(4) +
Me.Combo21.Column(5)


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hi all,

I want my combo37 to offer me values as follows (every time only 3
rows,
but
values depend on what i choose from other 2 combos: combo21 &
ToPerson1)

Me.Combo37.[ItemData](0) = Me.ToPerson1.Column(4)
Me.Combo37.[ItemData](1) = Me.ToPerson1.Column(5)
Me.Combo37.[ItemData](2) = Me.Combo21.Column(3) +
Me.Combo21.Column(4) +
Me.Combo21.Column(5)

I have placed this code on AfterUpdate event of Combo ToPerson1. (which
is
re-queried each time when Combo21 is updated)


However i was probably wrong as i get a message "run-time error 424:
Object
Required" when trying to update the Combo ToPerson1.


Can anybody give me a hint where i was wrong, please?

Thank you.
Lana
 
Back
Top