Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating 1 Combo from 2 Access Fields 2

Status
Not open for further replies.

LyallJ

MIS
Jul 18, 2001
124
US
I have a firstname and lastname field in an Access DB. I pull a record set and then populate a combo box with it. I have done this before with one field, but never two and I can't seem to figure this one out. Heres my code. This just gives me the first name in the combo and not the last name. Thanks for any help!!!

If rsremove.BOF = False Then
rsremove.MoveFirst
End If
With rsremove
If .EOF = True Then
names.Text = ""
Else
Do Until .EOF
names.AddItem !Firstname & Lastname
rsremove.MoveNext
Loop
End If
End With
 

You might try something like the following

names.AddItem Trim(rs!Firstname) & " " & Trim(rs!Lastname)

or by last name, you could

names.AddItem Trim(rs!LastName) & ", " & Trim(rs!Firstname) Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
It's probably just a typo but your line shown:

Code:
names.AddItem !Firstname & Lastname

should probably read

Code:
names.AddItem !Firstname & !Lastname

and you'll probably need to add Justins
Code:
& " " &
between the names
Let me know if this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top