Solved

Add a Full Name to my combobox

Posted on 2011-09-20
3
259 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 33

Accepted Solution

by:
paulmacd earned 500 total points
Comment Utility
  ...
   .AddItem rec.Fields(2) + "," + rec.Fields(1)
   ...
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
thank you!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

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…
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…

728 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

8 Experts available now in Live!

Get 1:1 Help Now