The problem is the the listindex property of a combobox is READ-ONLY. It is there for you to extract the value of the selection in the combobox but not to set it. It is a number starting at 0 for the first selection through the number of selections(n-1) in the Row Source property. Check out the ACCESS Help for ListIndex property of a combobox. The specifics are all there.
Had the same problem with a listbox. I know in the past I have sent sendkeys syntax to a listbox, but I think it's best to stay away from senkeys, as if you do not control where they go, all fun lets loose. Regards
Now if you are trying to set the selection of a Combobox you can do that by just assigning the value to it if the Bound Column value is something that you would know.
Example: If you want the ComboBox to refect "Bob" as the selection and FirstName is the Bound column either from your RowSource query or table then just enter the following code: me![ComboBoxName] = "Bob". Now the combobox selection is Bob and the field in the Control Source will be updated with that information when the record is saved.
Just a thought. Couldn't figure out why you wanted to set the listindex property and thought this is what you were trying to do. Bob Scriver
I don't know where you are getting this information but the listindex property seems to be read-only. Here is the ACCESS help on this property: LISTINDEX property
You can use the ListIndex property to determine which item is selected in a list box or combo box. Setting
The ListIndex property is an integer from 0 to the total number of items in a list box or combo box minus 1. Microsoft Access sets the ListIndex property value when an item is selected in a list box or list box portion of a combo box. The ListIndex property value of the first item in a list is 0, the value of the second item is 1, and so on.
This property is available only by using a macro or Visual Basic. You can read this property only in Form view and Datasheet view. This property is read-only and isn't available in other views.[
I tested this in both ACCESS 97 and 2000 and the same thing happens in both. I can read the property but cannot change it. ACCESS is in control of the property and wouldn't want you changing it as you may assign a value that is out of bounds.
Let me know if you find out something different or post the threads that show how to update the property.
First, THANK YOU for your timely support in answering my question.
Second - Yes, thanks to your help, I got my app working exactly as I want.
Third - OK, NOW I see what the problem is. I quoted what was in the "Example" section at the bottom of the page. I see what you quoted at the top of the same page. Apparently, there is a disconnect between what a macro or Visual Basic can do, and what the form's code module can do. This seems to be CRAZY. ANY control SHOULD have the property exposed the SAME way whether it is in the form's module or in a macro. I'm understanding more and more why my coworker programs in Paradox. I'll have to read the help files more closely.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.