Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering records in a list box

Status
Not open for further replies.

SmallTime

Technical User
May 17, 2004
127
GB
I’m trying to populate a list box ‘List2’ on a form ‘Frm_Alloc’ that’s bound to ‘Tbl_Referral with records that that are dependant on a combo box ‘CmbSite’ on a main menu ‘Frm_MMenu’.

If CmbSite is populated then I want the List2 to show the related records that match (Tb_Ref has a matching field called SiteName) otherwise if CbmSite is empty (nothing selected) then I want all the records in Tbl_Ref to be displayed in List2.

I thought the IIf Fuction in the Row Source query of List2 would do the trick but I seem to be having problems with the True part.

IIf(IsNull([Forms]![Frm_MMenu]![CmbSite]),([Tbl_Referral].[SiteName]) Like "*",[Forms]![Frm_MMenu]![CmbSite])

I’d be grateful for any help.
 
In the criteria cell of SiteName:
=[Forms]![Frm_MMenu]![CmbSite] Or [Forms]![Frm_MMenu]![CmbSite] Is Null

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Many thanks PHV. You nailed it just right.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top