I'm trying to assign a list of Names to a combobox control in Access VBA.
My problem is that the output string of names is not correct.
Here is my code:
Private Sub command186_click()
Dim firstName As String
Dim lastName As String
Dim rst As Object
Dim rowSourceText As String
Dim fullName As String
Set rst = CurrentDb.OpenRecordset("Pool_Contact")
Do While Not rst.EOF
firstName = rst("FName").Value
lastName = rst("LName").Value
fullName = firstName + " " + lastName
rst.MoveNext
Loop
Forms(FrmDaysAvailable).Controls("Combo202").rowSource = fullName
Debug.Print fullName
End Sub
I know that the error is somewhere inside of my loop, where the variable fullName is written over by the second result.
how can I fix this loop to produce a string that looks like fullName , fullName, fullName ...
Thanks for all your help
rst("FName").Valuewould berst.fields("FName").Value?rst.MoveNext,debug.print fullNamegives me the list of names separated by a line feed.