I'm trying to get the following code to run. If the cbo box has an entry, filter it on that. Otherwise use no filter. But the no filter (nothing selected in the cbo box) isn't working. Anyone see what I'm doing wrong?
Set rstSurg = db.OpenRecordset("SELECT tblMyTable.*, tblMyTable.Dept
FROM tblMyTable
WHERE (((tblMyTable.Dept)=IIf([forms]![frmMyForm]![cboDept]<>'',[forms]![frmMyForm]![cboDept],(tblMyTable.Dept) Like '*')));")
Set rstSurg = db.OpenRecordset("SELECT tblMyTable.*, tblMyTable.Dept
FROM tblMyTable
WHERE (((tblMyTable.Dept)=IIf([forms]![frmMyForm]![cboDept]<>'',[forms]![frmMyForm]![cboDept],(tblMyTable.Dept) Like '*')));")