View Full Version : Filter by Form


John Boyle
10-16-2001, 04:19 AM
I have a combobox that the user can select a value then the report is filtered by the selection. In my query I have: Forms![Main Form].[Value]
This works fine if the user selects a value. However I was hoping that if the combobox was left blank then it would not filter at all and give me all records in the table. Any suggestions on how to capture all records if nothing is selected in the combobox?
Thanks - John

SteveA
10-16-2001, 04:38 AM
Your query probably has a line like: Where [FieldA] = [Forms].[MainForm].[Value]) I changed this to be the following:

WHERE ([FieldA] = [Forms].[MainForm].[Value] and Not IsNull([Forms].[MainForm].[Value])) or (IsNull([Forms].[MainForm].[Value])

This can get a bit awkward when using many fields off a form. I generally use VBA when it gets that complicated.

HTH.
SteveA