I am using excel 365.
I have a drop down box as an input parameter to a query. I need to be able to check is that input parameter is null.
State: <drop down of available states>
Report showing city, zip code and other data
For the drop down box, I am using the following query:
Select null as [State]
UNION
Select distinct State from tbl_states
Then the query to display the report:
What I am using in the sql statement is:
Select columns
from table_State s
where ( s.State = ? or ? is null )
This is not working.
I know in tsql, it would be written:
declare @State varchar(50)
set @State= 'Ohio'
-- set @State = null
select distinct state
from tbl_States s
where ( (@State is null) or (s.State = @State) )
Any suggestions on how to correct my query?
I have a drop down box as an input parameter to a query. I need to be able to check is that input parameter is null.
State: <drop down of available states>
Report showing city, zip code and other data
For the drop down box, I am using the following query:
Select null as [State]
UNION
Select distinct State from tbl_states
Then the query to display the report:
What I am using in the sql statement is:
Select columns
from table_State s
where ( s.State = ? or ? is null )
This is not working.
I know in tsql, it would be written:
declare @State varchar(50)
set @State= 'Ohio'
-- set @State = null
select distinct state
from tbl_States s
where ( (@State is null) or (s.State = @State) )
Any suggestions on how to correct my query?