Show value if no results from query

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
 
D

Duane Hookom

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top