Solved

Add a Full Name to my combobox

Posted on 2011-09-20
3
264 Views
Last Modified: 2012-08-14
I have table in VB6 and want to put the Last name, comma, First Name in the drop down box on my form.  

After I pull up the data from database, the Last name is located in field(2)  The first name is in field(1)

Here is my code below for adding rec.Fields(2) to my dropdown box.  I don't know how to also add the first name to the same line in my drop down.

Would it look something like this?  

.AddItem rec.Fields(2), rec.Fields(1)
With Combo1
    Do While Not rec.EOF
    .AddItem rec.Fields(2)
    rec.MoveNext
    Loop
End With

Open in new window

0
Comment
Question by:al4629740
3 Comments
 
LVL 34

Accepted Solution

by:
Paul MacDonald earned 500 total points
ID: 36569711
  ...
   .AddItem rec.Fields(2) + "," + rec.Fields(1)
   ...
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 36570307
Just a very tiny tweak. It should probably be a comma plus a space between the parts of the names.

.AddItem rec.Fields(2) + ", " + rec.Fields(1)
0
 

Author Comment

by:al4629740
ID: 36570374
thank you!
0

Featured Post

Independent Software Vendors: 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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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.
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…
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…

713 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