no show if Null

juster21

Well-known Member
Joined
Jun 3, 2005
Messages
867
I'm trying to build a query that will look at one table and only return the fields that have values. The table has 1 record with 10 fields which is used to store parameter values.
I only want the parameters that have been selected and therefore have a value.

Thanks!!
 

Some videos you may like

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,935
Office Version
  1. 365
Platform
  1. Windows
Queries don't quite work like that. You have to explicitly tell it which Fields to include.
If you wanted it to work dynamically and only include Fields that have values, you would probably need to use VBA to build the SQL code for the4 query dynamically, looping through the fields for the records and determining which ones to include in the construction of your dynamic query.

What is it that you actually intend to do with this query when complete?
 

juster21

Well-known Member
Joined
Jun 3, 2005
Messages
867
Queries don't quite work like that. You have to explicitly tell it which Fields to include.
If you wanted it to work dynamically and only include Fields that have values, you would probably need to use VBA to build the SQL code for the4 query dynamically, looping through the fields for the records and determining which ones to include in the construction of your dynamic query.

What is it that you actually intend to do with this query when complete?

I have a report and I am trying to create a subreport that displays the criteria selected by the user.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,935
Office Version
  1. 365
Platform
  1. Windows
Depending on how you have written your report, you might be able to do something on the report level to suppress those Null entries.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,717
Messages
5,597,729
Members
414,169
Latest member
Preston_Cleric

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top