# Solved: Access : Query based on ComboBox Selection, if combo box is null show all



## MRdNk (Apr 7, 2007)

Hi All,

I've got a query that's based on the value of a combo box on a form, Criteria:



> [Forms]![frmSearchTenants]![cmbTenantSurname]


How do I adapt this to say if the cmbTenantSurname IsNull Then Show All, I'm guessing it's "*", but not sure how to write it.

Many thanks,
MRdNk


----------



## MRdNk (Apr 7, 2007)

Update:
I've gone for a new tack, I've programmatically run the query via a module, however now the requery doesn't update the subform.

ComboBox:


> Private Sub cmbTenantSurname_AfterUpdate()
> Call basDBQueries.QueryFindTenants(cmbTenantSurname.Value)
> Me.subSearchTenants.Requery​End Sub


Module:


> Public Sub QueryFindTenants(sWhere)
> Dim db As DAO.Database
> Dim qdf As DAO.QueryDef
> Dim sSQL As String
> ...


​
Just solved it, I changed the:


> Me.subSearchTenants.Requery


To:


> Me.subSearchTenants.SourceObject = "Query.qrySubSearchTenants"


----------



## jimr381 (Jul 20, 2007)

Congrats.

Typically I type:
Like *&[Please Enter Your TPS Report Name Here]&*

in the criteria of a parameter query to have it pull back all the items if they do not utilize the parameter.


----------

