Solved

How to add a value in a RowSource

Posted on 2002-05-08
1
1,251 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
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 …

737 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