Solved

USING COMBO CONTROL

Posted on 1998-10-27
9
228 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 50 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA Shell can't Find Word document 11 131
Modifying Conditional Format from VBA code 3 71
Add and format columns in vb6 7 71
Recommendation vb6 to vb.net or others 14 207
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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