Filtering/querying by field selection

  • Thread starter Thread starter martin
  • Start date Start date
M

martin

This is what I do. Make a form with as many combo boxes as
needed for your selections. Make sure the column 1 is your
bound column it makes it easier in the query of your
report. Then use 'between [myform]![fromcbx] and [myform]!
[tocbx]' in your query criteria.

Martin
 
this works if you are using a range. If you are filtering
by a particular item, say name then you would need to
approach it a little differently.

One way I worked around this was to create some global
variables that the form can pass values to, then created
functions to pull these values and pointed the queries to
these functions. i.e.

on the form
'for each item to be filtered on
if checkbox 1 = true then
Gcriteria1 = "Checkbox Value"
else
Gcriteria1 = "*"
end if

in module
public function getCriteria1() as string
getCriteria1 = gCriteria1
end function

in query

select * from Table1 where column 1 = getCriteria1();

This should work. Hope this helps

mweyland at mnqio dot sdps dot org
-----Original Message-----
This is what I do. Make a form with as many combo boxes as
needed for your selections. Make sure the column 1 is your
bound column it makes it easier in the query of your
report. Then use 'between [myform]![fromcbx] and [myform]!
[tocbx]' in your query criteria.

Martin
-----Original Message-----
Hello, I am trying to set up a button so that once
clicked, it will bring up a screen and allow you to make a
selection from a drop down menu for a particular field and
filter the report based on that selection. I can filter
out by field selection manually using the query, but I
would like to automate it. Any clues on how I can achieve
this? Thank you.
.
.
 
Back
Top