A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query to show all if parameter is blank



 
 
Thread Tools Display Modes
  #1  
Old July 9th, 2009, 09:33 AM posted to microsoft.public.access.queries
BOSS
external usenet poster
 
Posts: 85
Default Query to show all if parameter is blank

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
  #2  
Old July 9th, 2009, 10:12 AM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Query to show all if parameter is blank

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
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Boss" wrote in message
...
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


  #3  
Old July 9th, 2009, 10:26 AM posted to microsoft.public.access.queries
BOSS
external usenet poster
 
Posts: 85
Default Query to show all if parameter is blank

Thanks! It helped me a lot...

Boss

"Allen Browne" wrote:

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
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Boss" wrote in message
...
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



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:49 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.