Solved

USING COMBO CONTROL

Posted on 1998-10-27
9
224 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
  • 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Window placement 17 75
Updates not working for MS Windows 7 12 152
Excel - Save a copy of work book 13 82
VB 6 error 5 in windows 10 but not in XP 7 42
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now