Filter by Form

jboyle

New member
Local time
Today, 03:14
Joined
Nov 18, 2000
Messages
53
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
 
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
 

Users who are viewing this thread

Back
Top Bottom