no selected value on list box

romanticode

Registered User.
Local time
Today, 17:21
Joined
Oct 26, 2007
Messages
39
how can i filter my query, so if no list box item selected. the query will show all data.

thnks
 
IF you want the query to show all data you simply run it without filtering it!

Code:
Private Sub RunQueryButton_Click()
  If IsNull(Me.YourListBox) Then 
    'Run query unfiltered
  Else
    'Run filtered query
 End If 
End Sub
 
how can i filter my query, so if no list box item selected. the query will show all data.

thnks
This is classic example of what Jon K's FAQ demonstrates. I believe the "technical" name for this process is Query by Form. Queries that are run from form criteria can return all results by using the following SQL line (as many times as needed (for as many controls as the criteria section references))...
Code:
WHERE ([field] = Forms!FormName!ControlName OR
   Forms!FormName!Control IS NULL) AND ([color=red]Repeat the line here if needed[/color])
 

Users who are viewing this thread

Back
Top Bottom