Populate Query Criteria using Form

dan1qaz

New member
Local time
Today, 15:21
Joined
Feb 27, 2012
Messages
1
Hi,

I am trying to populate Query Criteria using a form, but I am looking for a way to just link the text box from the form to the actual criteria box in the query.

I am aware of the [forms]![form name].[text box name] method, but this seems to only set the criteria to "= whatever is in the text box".

If in the text box, I have something like "<> 55 And <> 58 And <>31", this would work in the criteria box, but it wouldn't work if I put it in the text box.

Is there any way for me to just directly link the text box and criteria box? I want what appears in the user input text box to be exactly what appears in the criteria box in the query.

Thanks very much,

Daniel
 
Using Access' built in filter by form feature is better than fiddling with textboxes etc. If you must re-invent the wheel, I guess the following could work:

1) Use VBA to write a proper filter string
2) Set the form's filter
3) Apply the filter

This depends on the user knowing how to create a proper filter, or you being able to solve that puzzle for them (frankly, your example is already not proper syntax). Bare bones simplicity: avoid all of this and just hit the not equal to button 3 times in succession (first, filter for not equal to 55, then filter for not equal to 58, then finally not equal to 31).
 

Users who are viewing this thread

Back
Top Bottom