[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to add a value in a RowSource

Posted on 2002-05-08
1
Medium Priority
?
1,278 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 200 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

872 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