Hello all,
I am trying to populate my subform from a listbox selection.
The problem is that I can see where there are 10 records in the subform navigation bar, but no records are visible.
Here is the code from the listbox on click event:
I am trying to populate my subform from a listbox selection.
The problem is that I can see where there are 10 records in the subform navigation bar, but no records are visible.
Here is the code from the listbox on click event:
Code:
Dim db as DAO.Database
Dim rs as DAO.Recordset
Dim strCWRFieldSelected as String
On Error GoTo ErrrorHappened
If lstCWR.ListIndex <> -1 Then
strCWRFieldSelected = lstCWR.ItemData(lstCWR.ListIndex)
Set db = CurrentDb
strSQL = "SELECT '" & strCWRFieldSelected & "' FROM CWRVerbiage"
Set sfCWRValues.Form.Recordset = db.OpenRecordset(strSQL, dbOpenSnapshot)
Else
GoTo ExitNow
End If
ExitNow:
On Error Resume Next
rs.Close
Set rs = Nothing
Set db = Nothing
Exit Sub
ErrorHappened:
MsgBox "Error " & Err.Number & " (" & Err.Description & ")"
Resume ExitNow
Resume