Show value if no results from query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a listbox in a form which has the following rowsource:

SELECT DISTINCT [Program].[Obligation], [Estimates].[Program],
[Estimates].[FY] FROM Program LEFT JOIN Estimates ON
[Program].[Obligation]=[Estimates].[Program] WHERE
((([Estimates].[Program])=IIf([program]="","none",[program])) And
(([Estimates].[FY])=[forms]![password]![fy]));

The only problem is, if there are no values returned from the queryt and
thus no values displayed in the listbox, users have nothing to select. I
would like for users to be able to select a value of "none" if there are no
values returned from the query and therefore no values to select from the
listbox. Does anyone know what I need to do to make this happen?

Thanks in advance,
geebee
 
You could try:
SELECT DISTINCT [Program].[Obligation], [Estimates].[Program],
[Estimates].[FY] FROM Program LEFT JOIN Estimates ON
[Program].[Obligation]=[Estimates].[Program] WHERE
((([Estimates].[Program])=IIf([program]="","none",[program])) And
(([Estimates].[FY])=[forms]![password]![fy]))
UNION
SELECT "None",Null, Null
FROM Program;
 
Back
Top