我正在尝试将名称列表分配给 Access VBA 中的组合框控件。
我的问题是名称的输出字符串不正确。
这是我的代码:
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
我知道错误出现在我的循环内部,其中变量 fullName 被第二个结果覆盖。
如何修复此循环以生成看起来像 fullName , fullName , fullName ...
感谢你的帮助