Solved

How to add a value in a RowSource

Posted on 2002-05-08
1
1,240 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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 …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

911 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

24 Experts available now in Live!

Get 1:1 Help Now