W
Wendy
Hello All,
with previous help from this forum, i have a combo box "Topic_MCQ_Sub_ID"
containing values from table "tblTopic_Sub" and also populates with a value
"<All>" via the UNION SELECT.
My Combo Box now looks like:
<ALL>
GI Physiology
PT Anatomy
FA Flactomoy
Now I'd like my subform to filter data based on the selection. It works
fine if I select either GI Physiology or PT Anatomy etc. But if i select
<All>, my subform returns 0 results. Can you please suggest where i may be
going wrong. Many thanks
SELECT tblTopic_MCQ.Topic_MCQ_ID, tblTopic_MCQ.Topic_MCQ_Main_ID,
tblTopic_MCQ.Topic_MCQ_Sub_ID, tblTopic_MCQ.Topic_MCQ_Description,
tblTopic_MCQ.Topic_MCQ_Answer_A, tblTopic_MCQ.Topic_MCQ_Answer_B,
tblTopic_MCQ.Topic_MCQ_Answer_C, tblTopic_MCQ.Topic_MCQ_Answer_D,
tblTopic_MCQ.Topic_MCQ_Answer_E, tblTopic_MCQ.[Topic_MCQ_ Answer_ True],
Right([Topic_MCQ_ Answer_ True],1) & ")" AS Topic_Answer_Short,
tblTopic_MCQ.Topic_MCQ_Order, tblTopic_MCQ.Topic_MCQ_Author,
tblTopic_MCQ.Topic_MCQ_Active, IIf([Topic_MCQ_ Answer_ True] Like
"*_A",[Topic_MCQ_Answer_A],IIf([Topic_MCQ_ Answer_ True] Like
"*_B",[Topic_MCQ_Answer_B],IIf([Topic_MCQ_ Answer_ True] Like
"*_C",[Topic_MCQ_Answer_C],IIf([Topic_MCQ_ Answer_ True] Like
"*_D",[Topic_MCQ_Answer_D],IIf([Topic_MCQ_ Answer_ True] Like
"*_E",[Topic_MCQ_Answer_E],"Good Grief, ask Karen"))))) AS Answer
FROM tblTopic_MCQ
WHERE
(((tblTopic_MCQ.Topic_MCQ_Main_ID)=[Forms]![frmTopic_MCQ_Mainform]![Topic_MCQ_Main_ID])
AND
((tblTopic_MCQ.Topic_MCQ_Sub_ID)=[Forms]![frmTopic_MCQ_Mainform]![Topic_MCQ_Sub_ID]))
OR
(((tblTopic_MCQ.Topic_MCQ_Main_ID)=[Forms]![frmTopic_MCQ_Mainform]![Topic_MCQ_Main_ID]) AND (([Forms]![frmTopic_MCQ_Mainform]![Topic_MCQ_Sub_ID]) Is Null))
ORDER BY tblTopic_MCQ.Topic_MCQ_Order;
with previous help from this forum, i have a combo box "Topic_MCQ_Sub_ID"
containing values from table "tblTopic_Sub" and also populates with a value
"<All>" via the UNION SELECT.
My Combo Box now looks like:
<ALL>
GI Physiology
PT Anatomy
FA Flactomoy
Now I'd like my subform to filter data based on the selection. It works
fine if I select either GI Physiology or PT Anatomy etc. But if i select
<All>, my subform returns 0 results. Can you please suggest where i may be
going wrong. Many thanks
SELECT tblTopic_MCQ.Topic_MCQ_ID, tblTopic_MCQ.Topic_MCQ_Main_ID,
tblTopic_MCQ.Topic_MCQ_Sub_ID, tblTopic_MCQ.Topic_MCQ_Description,
tblTopic_MCQ.Topic_MCQ_Answer_A, tblTopic_MCQ.Topic_MCQ_Answer_B,
tblTopic_MCQ.Topic_MCQ_Answer_C, tblTopic_MCQ.Topic_MCQ_Answer_D,
tblTopic_MCQ.Topic_MCQ_Answer_E, tblTopic_MCQ.[Topic_MCQ_ Answer_ True],
Right([Topic_MCQ_ Answer_ True],1) & ")" AS Topic_Answer_Short,
tblTopic_MCQ.Topic_MCQ_Order, tblTopic_MCQ.Topic_MCQ_Author,
tblTopic_MCQ.Topic_MCQ_Active, IIf([Topic_MCQ_ Answer_ True] Like
"*_A",[Topic_MCQ_Answer_A],IIf([Topic_MCQ_ Answer_ True] Like
"*_B",[Topic_MCQ_Answer_B],IIf([Topic_MCQ_ Answer_ True] Like
"*_C",[Topic_MCQ_Answer_C],IIf([Topic_MCQ_ Answer_ True] Like
"*_D",[Topic_MCQ_Answer_D],IIf([Topic_MCQ_ Answer_ True] Like
"*_E",[Topic_MCQ_Answer_E],"Good Grief, ask Karen"))))) AS Answer
FROM tblTopic_MCQ
WHERE
(((tblTopic_MCQ.Topic_MCQ_Main_ID)=[Forms]![frmTopic_MCQ_Mainform]![Topic_MCQ_Main_ID])
AND
((tblTopic_MCQ.Topic_MCQ_Sub_ID)=[Forms]![frmTopic_MCQ_Mainform]![Topic_MCQ_Sub_ID]))
OR
(((tblTopic_MCQ.Topic_MCQ_Main_ID)=[Forms]![frmTopic_MCQ_Mainform]![Topic_MCQ_Main_ID]) AND (([Forms]![frmTopic_MCQ_Mainform]![Topic_MCQ_Sub_ID]) Is Null))
ORDER BY tblTopic_MCQ.Topic_MCQ_Order;