UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> If combo box is blank return all records (parameter query)    
 
   
Jprogrammer
post Oct 23 2006, 03:10 PM
Post#1



Posts: 394
Joined: 16-March 05



If I leave my combo box unselected, instead of returning ALL records, my query returns only the records where the field in the table where the combo box is populated from has a value in it.
I've tried both:
CODE
Like [Forms]![myForm]![myControl] & "*" OR [Forms]![myForm]![myControl] Is Null
but this doesn't work either. I'm about to pull my hair out!!! crazy.gif
Any ideas? :-)
Go to the top of the page
 
truittb
post Oct 23 2006, 03:14 PM
Post#2


Retired Moderator
Posts: 13,563
Joined: 23-June 02
From: Texas (Is there anywhere else?)


Add a value to the Combo "-All-"
When the WHERE clause would be
WHERE (YourField like [Forms]![myForm]![myControl] & "*" or "-All-" = [Forms]![myForm]![myControl])
Go to the top of the page
 
Jprogrammer
post Oct 23 2006, 03:22 PM
Post#3



Posts: 394
Joined: 16-March 05



Thanks for replying so fast truittb! My combo box Row Source is a table. Can I still do this by setting the default value of the combo box to All?
Go to the top of the page
 
truittb
post Oct 23 2006, 03:23 PM
Post#4


Retired Moderator
Posts: 13,563
Joined: 23-June 02
From: Texas (Is there anywhere else?)


Change the source to a Query and use a Union query with ALL

Select "-ALL-"
Union
Select YourField
From YourTable
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    10th December 2017 - 11:12 PM