coding a value for a dropdown list field

grenee

Registered User.
Local time
Today, 15:28
Joined
Mar 5, 2012
Messages
212
Good Day All,

My field "Categories" acquired its values from a dropdown listbox. However I want, in some cases, to code in a value known to be in the dropdown listbox. Although the values entered in the code corresponds with what is in the dropdown list I am getting an error message which says: "the Value you entered isn't valid for this field"

Here is the code line:
Code:
 Me.Categories = "Lamp Shades"

I would be grateful for any assistance in this matter
 
Last edited:
Please tell us more about your set up -the table(s) involved and the Form involved.
Readers need some context to understand your issue.
 
if your combobox has more than one
column and the bound column (column 1)
is hidden, and only showing the column 2
(the descriptive name). then it would fail.
you must search the combo for the value:

Dim i As Integer
For i = 0 To Me.Combo0.ListCount - 1
If Me.Combo0.Column(1, i) = "Lamp Shades" Then
Me.Combo0 = Me.Combo0.ItemData(i)
Exit For
End If
Next
 

Users who are viewing this thread

Back
Top Bottom