By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,315 Members | 1,611 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,315 IT Pros & Developers. It's quick & easy.

Access forms

P: 1
I want to use a form to drive a query in Access. Is it possible to have the user enter a < or > in a form to drive a greater than or less than query search?
Nov 6 '11 #1
Share this Question
Share on Google+
1 Reply


Expert Mod 2.5K+
P: 2,545
It is certainly possible to use a specialised search form where users can select the fields to search and do so in ways you define. To avoid problems with users inputting invalid operators I would suggest you simply make the operator selectable using a combo box, say.

To apply the user-defined search you would build a SQL search string in code. The operator can be included as part of the string, like this:

Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT * FROM SomeTable WHERE [SomeTotal " & Me!cboOperator & " " & Me!txtSomeValue
You may find some useful tips about building such strings in ths insight article: Example filtering on a form.

-Stewart
Nov 7 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.