473,394 Members | 1,751 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

{SOLVED} combo box user updating 2nd column

3
G'day guys, I have been trying to use a combo box with two columns. In the first column I am listing 10 items from a table, in the second colum I would like the user to enter some data. The first column lists fine but I can't get anything into the second column. Hope you can help.
I'm using XP and Access 97
Thanks
Nov 13 '06 #1
4 1494
MMcCarthy
14,534 Expert Mod 8TB
G'day guys, I have been trying to use a combo box with two columns. In the first column I am listing 10 items from a table, in the second colum I would like the user to enter some data. The first column lists fine but I can't get anything into the second column. Hope you can help.
I'm using XP and Access 97
Thanks
To add items to a combo box (or a listbox for that matter) you need to do the following.

Assuming you don't want these values saved in a table.
Create a new textbox for entering the data to be added. Lets call it txtNewData.
Create a command button to put the code behind. Lets call it cmdAddData.
You don't give the name of the combobox so I'm calling it Combo2 for now.

Put this code in the On Click event of the command button:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub cmdAddData_Click()
  3. Dim rowSrc As String
  4.  
  5.   rowSrc = Me.Combo2.RowSource
  6.   rowSrc = rowSrc & ";'" & Me.txtNewData & "'"
  7.   Me.Combo2.RowSource = rowSrc
  8.  
  9. End Sub
  10.  
  11.  
This code will add whatever is in txtNewData to the combobox whenever the button is clicked.
Nov 13 '06 #2
parkie
3
To add items to a combo box (or a listbox for that matter) you need to do the following.

Assuming you don't want these values saved in a table.
Create a new textbox for entering the data to be added. Lets call it txtNewData.
Create a command button to put the code behind. Lets call it cmdAddData.
You don't give the name of the combobox so I'm calling it Combo2 for now.

Put this code in the On Click event of the command button:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub cmdAddData_Click()
  3. Dim rowSrc As String
  4.  
  5.   rowSrc = Me.Combo2.RowSource
  6.   rowSrc = rowSrc & ";'" & Me.txtNewData & "'"
  7.   Me.Combo2.RowSource = rowSrc
  8.  
  9. End Sub
  10.  
  11.  
This code will add whatever is in txtNewData to the combobox whenever the button is clicked.
Many Thanks I'll give this a try
Nov 13 '06 #3
parkie
3
I tried it and it worked first time, thank you.
Nov 14 '06 #4
MMcCarthy
14,534 Expert Mod 8TB
I tried it and it worked first time, thank you.
No Problem

I'm marking this solved if no one has any objections.
Nov 14 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bobbak | last post by:
Hello All, I was wondering if it is at all possible to have a single combo box update multiple fields in a single record. For example I have created an Employee Info form, and in that form there's...
5
by: Dalan | last post by:
I have been searching the archives in an effort to discover how to derive a dual use of a single combo box - so far no go. I found the piece below which pretty much represents the usage. To...
2
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
8
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". ...
15
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
9
by: Marianne160 | last post by:
Hi, I know there are various answers to this problem available on the web but none of them seem to work for me. I am using Access 2003 to make a form to look up data from a table. I have so far...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.