Hi,
I have a query where I want to select based on the value of a combo box on a form if it is not null else select all records. See below SQL which is not working as no records are being selected when the combo box is null. Could you help please..?
SELECT tblEnquires.ID,tblEnquires.TraderCombo ...more tables
FROM tblEnquires
WHERE (((tblEnquires.ReceivedBy)=IIf(IsNull([forms]![frmEnquireOnEnquires2]![TraderCombo]),([tblEnquires].[ReceivedBy]) Like "*",[forms]![frmEnquireOnEnquires2]![TraderCombo])));
I have a query where I want to select based on the value of a combo box on a form if it is not null else select all records. See below SQL which is not working as no records are being selected when the combo box is null. Could you help please..?
SELECT tblEnquires.ID,tblEnquires.TraderCombo ...more tables
FROM tblEnquires
WHERE (((tblEnquires.ReceivedBy)=IIf(IsNull([forms]![frmEnquireOnEnquires2]![TraderCombo]),([tblEnquires].[ReceivedBy]) Like "*",[forms]![frmEnquireOnEnquires2]![TraderCombo])));