Solved

How to add a value in a RowSource

Posted on 2002-05-08
1
1,237 Views
Last Modified: 2007-12-19
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
0
Comment
Question by:bylj
1 Comment
 
LVL 1

Accepted Solution

by:
dougp23 earned 50 total points
ID: 6996766
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.

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now