Solved

Add a Full Name to my combobox

Posted on 2011-09-20
3
261 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 46

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

832 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