Query to show all if parameter is blank

B

Boss

Hi,

I run a query which returns me filtered record based on textbox1 value on
form (master). I have added the criteria in the design view of the query.

[Forms]![Master]![textbox1]

If textbox1 value is vlank then no records are returned, whereas if textbox1
value is blank then i wish to ahev all record, please help me deal with
this...

thx!
Boss
 
A

Allen Browne

Switch the query to SQL View.
Locate the WHERE clause.

If it says:
WHERE SomeField = [Forms]![Master]![textbox1]
change it to:
WHERE ((SomeField = [Forms]![Master]![textbox1])
OR ([Forms]![Master]![textbox1] Is Null))

Careful with the bracketing if you have other criteria here.
 
B

Boss

Thanks! It helped me a lot...

Boss

Allen Browne said:
Switch the query to SQL View.
Locate the WHERE clause.

If it says:
WHERE SomeField = [Forms]![Master]![textbox1]
change it to:
WHERE ((SomeField = [Forms]![Master]![textbox1])
OR ([Forms]![Master]![textbox1] Is Null))

Careful with the bracketing if you have other criteria here.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Boss said:
Hi,

I run a query which returns me filtered record based on textbox1 value on
form (master). I have added the criteria in the design view of the query.

[Forms]![Master]![textbox1]

If textbox1 value is vlank then no records are returned, whereas if
textbox1
value is blank then i wish to ahev all record, please help me deal with
this...

thx!
Boss
 

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