Creating a query filter form for users

  • Thread starter encohen via AccessMonster.com
  • Start date
E

encohen via AccessMonster.com

I have, in the past, created, what I call, a query filter form, that allows
the user to select the criterion without any knowledge of SQL. I always
placed "AND" in between the where clauses. Now I want to allow the user to
select either an AND or an OR. I have used combo boxes but it just looks too
confusing to me and to the user. Has anyone done this kind of thing before?
This is very hard to describe in words, so I hope I am making some sense.
Again, I need some kind of easy-to-use form so that the use can select not
only the criteria, but also how the clauses are joined (using AND or an OR).
Thank you in advance.

Ed Cohen
 
B

Beetle

One option would be to use an option group with two buttons, with
descriptions
like "find records that match All criteria" and "find records that match Any
criteria".

Then, in code you could use something like the following;

Dim strJoin As String
Dim strSQL As String

Select Case Me.MyOptionGroup
Case 1
strJoin = "And"
Case 2
strJoin = "Or"
End Select

strSQL = "SELECT SomeField, SomeOtherField FROM SomeTable " _
& "WHERE SomeField = SomeValue " & strJoin _
& " SomeOtherField = SomeOtherValue;"

_________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top