Full Version: Filter Form Combo Box Choices
UtterAccess Forums > Microsoft® Access > Access Forms
Matt_S
Greetings all.
Need some help getting a subform combo box to display filtered selections.
Right now the subform filter is:
CODE
SELECT [Dancers].[ID], [Dancers].[Entertainer] FROM Dancers ORDER BY [Entertainer];

And what I want to do is basically add WHERE [RecordSourceFieldName] = "True" but adding that to the end of the current subform filter doesn't work. Nor does adding it to the combobox's events.

As always any help is greatly appreciated.
RJD
Hi Matt: Is [RecordSourceFieldName] a yes/no field or is it text with "True" or "False"? Where is this field/control located (table/query or form)? How are you adding this to the query? What do you mean by "does not work"? Do you get an error, or the wrong results, or no results, etc.?

I am sure we can help you straighten this out, but we'll need more information to do so. Could you post the db (relevant objects, example records, zipped)? That would be the best bet here.

HTH
Joe
Matt_S
The record source field I want to filter by is a check box. The field is named "Active"
It is located in the table the subform gets it's info from. I get a syntax error (missing operator) if I do:
CODE
SELECT [Dancers].[ID], [Dancers].[Entertainer] FROM Dancers ORDER BY [Entertainer] WHERE [Active]="True";

Or [Dancers].[Active]IsNotNull, ="True", or ="1"
RJD
Hi: The Where must precede the Order By, and since the field is yes/no, you do not use quotes on True. Or you could use -1 instead. Putting quotes around True means it is a text field.

HTH
Joe

from phone
Matt_S
That did the trick.
Putting the Where before Order By and removing the quotes from True works like a charm.

Thanks again for the assist.

Everyone's been awesome so far about helping and it makes it much less intimidating to try things and then ask for help when it doesn't go as planned.
RJD
You are very welcome, Matt. We are always happy to assist.

Good luck with your db.

Regards,
Joe

from phone
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.