Reputation: 365
How can i space this string so it formats with a space in between the names?
Like so James Marshall
At the moment it reads JamesMarshall
Public Function PopulateContactCmb(CompanyValue As Integer)
With Forms!MainForm!cmbContactList
.RowSource = "SELECT Contacts.ID, FirstName " + " & LastName AS FullName FROM Contacts WHERE CompanyID = " & CompanyValue & ";"
.ColumnCount = 4
.BoundColumn = 1
.ColumnWidths = "0in.;2in.;2in.;"
End With
Upvotes: 0
Views: 258
Reputation: 44871
Try changing the relevant part of the select statement to this:
SELECT Contacts.ID, FirstName & ' ' & LastName AS FullName
Edit: changed from + to & for concatenation to reflect information in a comment that I didn't think of.
Upvotes: 2
Reputation: 4808
Change the RowSource
assignment to something like this:
.RowSource = "SELECT Contacts.ID, FirstName & ' ' & LastName AS FullName FROM Contacts WHERE CompanyID = " & CompanyValue & ";"
Upvotes: 3