?
Solved

USING COMBO CONTROL

Posted on 1998-10-27
9
Medium Priority
?
231 Views
Last Modified: 2010-04-30
I HAVE A COMBO CONTROL AND WOULD LIKE TO IDENTIFY WHICH ITEM IN THE LIST A USER HAS SELECT SO THAT I CAN MOVE THE INFORMATION INTO A TEXT FIELD.
0
Comment
Question by:bbrown23
[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
  • 5
  • 4
9 Comments
 

Accepted Solution

by:
timpeters earned 100 total points
ID: 1441868
Using the following will work:
 Text1.text = combo1.list(combo1.listindex).

This will move that info into the textbox when the user selects it.
0
 

Expert Comment

by:timpeters
ID: 1441869
place that code into the Combo1_Click() event so it will execute when the user selects the info.
0
 

Author Comment

by:bbrown23
ID: 1441870
I FORGOT TO MENTION THAT THE COMO BOX IS MADE UP OF TWO COLUMNS.  HOW DO I GET THE DATA FROM COLUMN 1 INTO A TEXT FIELD AND COLUMN 2 INTO ANOTHER TEXT FIELD?
0
Industry Leaders: 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!

 

Expert Comment

by:timpeters
ID: 1441871
First of all I believe that you are using a listbox instead of a combobox because a listbox supports multiple columns whereas a combobox does not.  Even though you have 2 columns, each piece of information still has it's own index.  Therefore the following will work:

If List1.ListIndex > List1.ListCount / 2 Then
Text1.Text = List1.List(List1.ListIndex)
Else
Text2.Text = List1.List(List1.ListIndex)
End If

0
 

Expert Comment

by:timpeters
ID: 1441872
First of all I believe that you are using a listbox instead of a combobox because a listbox supports multiple columns whereas a combobox does not.  Even though you have 2 columns, each piece of information still has it's own index.  Therefore the following will work:

If List1.ListIndex > List1.ListCount / 2 Then
Text1.Text = List1.List(List1.ListIndex)
Else
Text2.Text = List1.List(List1.ListIndex)
End If

0
 

Author Comment

by:bbrown23
ID: 1441873
I THOUGHT THAT YOU COULD USE A COMBO BOX WITH MORE THAN ONE COLUMN, AND BE ABLE TO USE IT LIKE A 2 DIMENSIONAL ARRAY. FOR EXAMPLE:

COLUMN 1       COLUMN 2

ABC              123
DEF              678
 THEN BASED ON THE USERS SLECTION MOVE THE CONTENTS OF COLUMN 1 INTO TEXT FIELD1  AND THE CONTENTS OF COLUMN 2 INTO TEXT FIELD 2

I HOPE I HAVE MADE MYSELF CLEAR?

THANKS

BRUCE BROWN
0
 

Author Comment

by:bbrown23
ID: 1441874
ONE MORE ITEM I'M USING VBA WITHIN ACCESS
0
 

Expert Comment

by:timpeters
ID: 1441875
A combo box does not support column distinction.  Although it has three different styles, eseentially it is still a dropdown box.  It cannot distinguish between columns.  It only has one.  A list box however does support multiple columns and works very similar to a combobox.  I recommend using that if you want 2 columns.  Just set it's columns property to 2.
0
 

Author Comment

by:bbrown23
ID: 1441876
JUST TO LET YOU KNOW I FOUND A WAY TO ACCESS THE DIFFERENT COLUMNS IN A COMBO BOX:

Private Sub VESSEL_AfterUpdate()
selVESSEL = vessel.Column(0)
selCPDATE = vessel.Column(1)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

762 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