Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null combo box then select all.

Status
Not open for further replies.

longmot

Programmer
Apr 22, 2002
11
GB
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])));

 

[tt]
WHERE tblEnquires.ReceivedBy =

([forms]![frmEnquireOnEnquires2]![TraderCombo])

OR

(([forms]![frmEnquireOnEnquires2]![TraderCombo]) Is Null));
[/tt] Jeff Roberts
Analysis, Design, & Implementation
RenaissanceData.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top