S
spokane29 via AccessMonster.com
I have a listbox that has the following SQL in a query:
SELECT tblResponsesList.Rspns, tblResponsesList.QstnID
FROM tblResponsesList
WHERE (((tblResponsesList.QstnID)=[Form]![QstnID]));
I want to have it if I return back to the record at some point, the listbox
will show all the options and have selected the selected choices that are
stored in tblResponses.
I have tried:
For x = 0 To ListRspns.ListCount - 1
If ListRspns.ItemData(x) = DLookup("Rspns", "tblResponses", "QstnID=" & Me!
QstnID) Then
ListRspns.Selected(x) = True
End If
Next x
However, for some reason this is not working. Thoughts? Could it be because
I have 2 columns in my listbox (Rspns and QstnID)?
The table structure is:
tblAssociates
--AssociateID
--Associate_Last_Name
--Associate_First_Name
--etc...
tblResponse
--AssociateRef (1-many with tblAssociates.AssociateID)
--QstnID
--Rspns
--ResponseDate
tblQuestions
--QstnID (1-many with tblResponses.QstnID)
--text
--etc
tblResponsesList
--QstnID (1-many with tblQuestions.QstnID)
--Rspns
In the listbox it shows all options in tblResponsesList that have a
corresponding QstnID to the one in tblQuestions. When selections are made in
the listbox, the results are saved to tblResponses. I am looking at wanting
the listbox to still pull from tblResponsesList, but "select" the result from
tblResponses if someone goes to review. The listbox contains the fields
Rspns and QstnID.
SELECT tblResponsesList.Rspns, tblResponsesList.QstnID
FROM tblResponsesList
WHERE (((tblResponsesList.QstnID)=[Form]![QstnID]));
I want to have it if I return back to the record at some point, the listbox
will show all the options and have selected the selected choices that are
stored in tblResponses.
I have tried:
For x = 0 To ListRspns.ListCount - 1
If ListRspns.ItemData(x) = DLookup("Rspns", "tblResponses", "QstnID=" & Me!
QstnID) Then
ListRspns.Selected(x) = True
End If
Next x
However, for some reason this is not working. Thoughts? Could it be because
I have 2 columns in my listbox (Rspns and QstnID)?
The table structure is:
tblAssociates
--AssociateID
--Associate_Last_Name
--Associate_First_Name
--etc...
tblResponse
--AssociateRef (1-many with tblAssociates.AssociateID)
--QstnID
--Rspns
--ResponseDate
tblQuestions
--QstnID (1-many with tblResponses.QstnID)
--text
--etc
tblResponsesList
--QstnID (1-many with tblQuestions.QstnID)
--Rspns
In the listbox it shows all options in tblResponsesList that have a
corresponding QstnID to the one in tblQuestions. When selections are made in
the listbox, the results are saved to tblResponses. I am looking at wanting
the listbox to still pull from tblResponsesList, but "select" the result from
tblResponses if someone goes to review. The listbox contains the fields
Rspns and QstnID.