D
Daama via AccessMonster.com
Hi All,
I am trying to display a list of all field names in a particular query/table.
I am trying the code below but it only gives me one single name rather than
the whole list.
I would appreciate any help! Table name=buyer, listbox= lstSelectFrom
Dim rs As DAO.Recordset
Dim fld As DAO.Field
Dim strSQL As String
Dim strMsg As String
Dim strStart As String
strSQL = "Select * from buyer"
Set rs = CurrentDb.OpenRecordset(strSQL)
For Each fld In rs.Fields
strMsg = strMsg & fld.Name & vbNewLine
Next
strStart = "" _
& "" & vbNewLine & vbNewLine
Me.lstSelectFrom.RowSource = strStart & strMsg
Me.lstSelectFrom.RowSourceType = "value list"
If I display the list on a msgbox, it will work just fine
e.g MsgBox strStart & strMsg, vbInformation, ""
Thanks,
I am trying to display a list of all field names in a particular query/table.
I am trying the code below but it only gives me one single name rather than
the whole list.
I would appreciate any help! Table name=buyer, listbox= lstSelectFrom
Dim rs As DAO.Recordset
Dim fld As DAO.Field
Dim strSQL As String
Dim strMsg As String
Dim strStart As String
strSQL = "Select * from buyer"
Set rs = CurrentDb.OpenRecordset(strSQL)
For Each fld In rs.Fields
strMsg = strMsg & fld.Name & vbNewLine
Next
strStart = "" _
& "" & vbNewLine & vbNewLine
Me.lstSelectFrom.RowSource = strStart & strMsg
Me.lstSelectFrom.RowSourceType = "value list"
If I display the list on a msgbox, it will work just fine
e.g MsgBox strStart & strMsg, vbInformation, ""
Thanks,