473,624 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting a combo box to store multiple values

35 New Member
Hi,

I am setting up a database and would like a combo box on a form to store two values. for example, there's a ID and a Description. I can easily get the combo box to show both the ID and the Description. however the combo box is tied in to one field only, in this case, the ID.

I'd like the form to store both the ID and then display the Description in a field next to the ID.

your assistance is much appreciated, thanks!

Todd
Apr 23 '09 #1
32 22156
NeoPa
32,567 Recognized Expert Moderator MVP
I'm not sure what you're asking Todd.

Your explanation seems to contradict anything I think you're asking :S
Apr 23 '09 #2
tfurubay
35 New Member
sorry about that!

i've built a form that needs to store hotel ID, hotel with other client info. the hotel id and hotel are stored in a seperate table. when the combo box is opened, hotel id and hotel appear in the pull down. however b/c the combo box is built on a field controled by hotel ID, only the hotel ID is transferred to the form. the hotel field remains blank. i was going to build a macro and create an update query (im a GUI person) to update the hotel field but i'd prefer to build an expression that based on the hotel ID, can update the Hotel. hope that makes a little more sense.

thanks

todd
Apr 23 '09 #3
mshmyob
904 Recognized Expert Contributor
Use the 'column' parameter with the combobox value.

Expand|Select|Wrap|Line Numbers
  1. Me.txtYourTextBoxName = Me.cboYourComboName.Column(0)
  2. ' or
  3. Me.txtYourTextBoxName = Me.cboYourComboName.Column(1)
  4.  
Each column number refers to each column in your combo box.

Does this help

cheers,
Apr 23 '09 #4
NeoPa
32,567 Recognized Expert Moderator MVP
I'm sorry Todd. If all the words made perfect sense in sequence, the punctuation would possibly not matter so much. As it is, I can only guess which words are in the right place from the punctuation, which is missing or misplaced in most cases. Most of the words are probably wrong because you don't have a very good grasp of the terminology, which is quite understandable, but it makes taking care to punctuate and not drop random words, all the more important.

What do you have as the RowSource of your ComboBox (I'm assuming the pull down from one sentence is actually referring to the combo box from the next)?
What are the values for Column Count, Column Widths & Bound Column in your ComboBox control?
Apr 23 '09 #5
tfurubay
35 New Member
MSHMYOB,

sorry pls bear with me. when i create the combo box, i use the wizard therefore many of these underlying controls are not visible. what i do is i use the wizard to prepare the box. here are the steps:

1) wizard asks me the source, i tell it the hotel table
2) asks me which fields would i like to see in the pull down. i tell it hotel ID and hotel
3) asks me where i'd like this data stored. i tell it hotel ID.

is there a back end control or expression where i could tell it to do what you recommend?

thanks again
Apr 23 '09 #6
tfurubay
35 New Member
neopa,

we obviously have a communication barrier but i appreciate your dedication the the cause.

here are the current settings:

control source: Hotel ID
Row Source: SELECT Hotels.HID, Hotels.Hotel FROM Hotels;
bound column: 1

so from this:

"Control Source" is the Hotel ID and is the field on the form that is updated from the combo box
"row source" determines which fields are displayed in the combo box pull down
"Bound Column" is the field that gets stored

again, i'd like to store the both the hotel id and hotel however it doesnt seem to allow you to do that in the GUI.

Thanks NEO.
Apr 23 '09 #7
NeoPa
32,567 Recognized Expert Moderator MVP
There's certainly a way of finding the info I asked for.

If you view the form in Design mode, click on the newly created ComboBox control and select Properties (Alt-Enter will do this for you).
Look through the properties and note (& post) the values of the properties I requested.

A wizard is merely a way of doing ordinary designs more easily. What it produces can be done manually just as well (but not so easily for someone short of experience).

PS. Just caught your latest post and now processing...
Apr 23 '09 #8
tfurubay
35 New Member
Hi,

yes, i rarely design forms so i am pretty green...

here are those values, thanks!

Row Source: SELECT Hotels.HID, Hotels.Hotel FROM Hotels;
Column Count: 2
Column Widths: 0.3646";1.8646"
Bound Column: 1
Apr 23 '09 #9
NeoPa
32,567 Recognized Expert Moderator MVP
@tfurubay
I think you're starting to grasp some of the concepts here Todd.

I also think I've started to grasp what you're trying to ask (originally). If I'm not mistaken, you're asking how to get the ComboBox control to maintain two fields in the underlying recordset (that the form is built upon). Is that about the size of it?

If so, then I'm afraid that facility is not supported. There can be only one Control Source for the control. However...

It is possible to put some VBA code in the AfterUpdate event of the control, such that a separate control (bound to a separate field from the underlying recordset) is updated. Another however coming I'm afraid...

This is not a good idea as Normalised Relational Databases (Normalisation and Table structures) are designed to work differently. This would be de-normalising your data (which is not a great idea - trust me).
Apr 23 '09 #10

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

Similar topics

7
2552
by: Philipp H. Mohr | last post by:
Hello, I would like to store multiple dictionaries in a file, if possible one per line. My code currently produces a new dictionary every iteration and passes it on to another peace of code. In order to be able to re-run some experiments at a later date I would like to store every dictionary in the same file. I looked at pickel, but that seems to require a whole file for each dictionary.
2
6562
by: Jen F. | last post by:
I have inherited a medical database in which there are multiple values stored in a single field (ie. "Current Conditions" field might contain 1-20 different conditions, separated by comma (ie. "Heart Disease,Hyper Tyroid,Cancer" etc. I would like to search via combo box for any one or more than one value in this field, ie-what patients have Heart Disease or Cancer by selecting these disorders off the combo box list. Any help would be...
5
2243
by: Homer Simpson | last post by:
Hi All, I'm trying to write a method where I pass three arguments and the method returns six values. All the values will be doubles. First, is it possible to get multiple values returned by a method? Second, how do I do it? I know how to write the method, pass arguments to it and get a single value returned but how do I pass multiple values back? Last, how do I reference the various values returned? I assume there is some array used...
0
2111
by: g.o.atkins | last post by:
Hi, Is there anyway to store multiple values in the System.Net.Cookie object?? I cannot use the System.Web.HttpCookie object (which allows for multiple values) as I am trying to set the SoapHttpClientProtocol.CookieContainer property which only accepts System.Net.Cookie as a parameter.
1
3078
by: sheenaa | last post by:
Hello friends, I m using ASP.NET with C# 2005 and SQL SERVER 2005 for the ASP.Net Website. I m using sqldatasource to connect and retrieve the data from database and then it displays the data in the gridview on the button click event.I have created the stored procedure for insert and select query. Now in my application i have used checkboxlist where there can be multiple selection for the hobbies. I want to know how can i store the...
1
2194
by: wendy184 | last post by:
I'm used to using 2007 which allows multiple values in the lookup wizard, this helps hugely with my queries as the database i'm building has information on one parent who may have up to 5 kids. Now i'm building up a similar database in 2000 and could really use some help, 2000 won't allow multiple values in a lookup field which means if I have a parent who has more than one kid I cant store the details, I have a seperate table for both parent...
0
883
by: NothingMore | last post by:
I am using VB .NET and I am stumped as I draw blanks and cant find anything about adding multiple values to a combo box item. Without using external files. Example: (hope this helps a bit) First Combo Box = Nation (4 Nations guess thats useless info) Second Combo Box = Unit Type (with 11 values each unit type has) Third Combo Box = (One of the 11 values from the unit type selection in combo box 2)
2
8435
by: MicaK | last post by:
Good Morning, I am new to this forum, and extremely new to VBA, so there may be a very simple explanation to this. I also apologize if I am giving you and excessive amount of detail. I have a table, tblAdmissions. One of the columns is for Certification and was set up as a lookup field that allows multiple values to be selected. In my form, the label for this field is called lblCertification, and the combo box is called cboCertification. ...
1
3900
by: sarankarthik | last post by:
Hi, I have some array of values,say for example Attribute1 contains 1,2,3,4,5,6,7 values.. Please tell me how can i store multiple values in an xml file for a single variable. Thanks, SK>
0
8177
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6112
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.