Question : How to add a value in a RowSource

Have 2-Questions:

1. Have a field in a table, with:
Display Control = ComboBox
RowSourceType = Value List
RowSource = Brother;Cousin;Sister

How do I add another value/item in RowSource through VBA?

2. The same field is displayed as a combo-box on a form. Similarly, how do I add a value to a RowSource of this combo-box through VBA?

thanks in advance

Answer : How to add a value in a RowSource

1.  Define your rowsource in VBA (say StrRowSource).  Then, say your listbox is List1, you would say List1.Rowsource = strRowSource.  You can then add to it by saying

strRowSource = strRowSource & "," & newValue

(Your strRowSource must be comma separated).

2.  On the form, set the Limit to List property to True.  Then, you need to set an even for "Not in List".  You should then prompt the user if they really want to add this item, then if they do, you can do the same VBA thing, where you would add newValue to strRowSource.

Obviously, I left a lot of nitty gritty out!  Maybe this will get you started.

Random Solutions  
 
programming4us programming4us