Solved

USING COMBO CONTROL

Posted on 1998-10-27
9
221 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
Comment Utility
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
Comment Utility
place that code into the Combo1_Click() event so it will execute when the user selects the info.
0
 

Author Comment

by:bbrown23
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Expert Comment

by:timpeters
Comment Utility
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
Comment Utility
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
Comment Utility
ONE MORE ITEM I'M USING VBA WITHIN ACCESS
0
 

Expert Comment

by:timpeters
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

772 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

11 Experts available now in Live!

Get 1:1 Help Now