SQL Parameter Null
Discussion
Novice here. Don't bite. Building something very basic via MS Query to display in MS Excel.
My query has a parameter however, if the user does not select a parameter, I would like it to return all records.
With simply a parameter against the table (I'll call it Table1) the part in question looks like this when I open SQL statement:
WHERE Table1=?
Is it possible to add to this so all records will be displayed if for example the field was Null. Effectively ignoring the parameter for lack of a better explanation.
My query has a parameter however, if the user does not select a parameter, I would like it to return all records.
With simply a parameter against the table (I'll call it Table1) the part in question looks like this when I open SQL statement:
WHERE Table1=?
Is it possible to add to this so all records will be displayed if for example the field was Null. Effectively ignoring the parameter for lack of a better explanation.
It's WHERE Attribute [not Table] = IIF(@Parameter is NULL, Attribute [so always true i.e. should retrieve everything], @Parameter)
It's a bit nonsensical, but should work in your example - although you haven't given a lot of information...
Is the information you are querying contained in the spreadsheet itself or externally held? What version of Excel are you using?
It's a bit nonsensical, but should work in your example - although you haven't given a lot of information...
Is the information you are querying contained in the spreadsheet itself or externally held? What version of Excel are you using?
eps]It's WHERE Attribute [not Table said:
= IIF(@Parameter is NULL, Attribute [so always true i.e. should retrieve everything], @Parameter)
It's a bit nonsensical, but should work in your example - although you haven't given a lot of information...
Is the information you are querying contained in the spreadsheet itself or externally held? What version of Excel are you using?
Thank you but sadly gives me a Parameters are not allowed in queries that can't be displayed graphically error.It's a bit nonsensical, but should work in your example - although you haven't given a lot of information...
Is the information you are querying contained in the spreadsheet itself or externally held? What version of Excel are you using?
The information is held externally.
Using O365 version of Excel.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


