[AccessD] Filter by Form stuff

Max Wanadoo max.wanadoo at gmail.com
Wed Apr 16 01:30:07 CDT 2008


Arthur,
I think the simplest way to do this is to ignore all the filter by form
stuff and just do the following.
1. After the filter by form stuff executes create a recordset based on what
is now in the form's recordset.
2. ie. Dim rst as dao.recordset : Dim strLookup as string : set rst =
me.recordsetclone 
3. Then loop through this recordset to create the lookup criteria for the
combo box.
4. ie. Rst.movefirst : do while not rst(eof) : strLookup = strLookup &
vbcrlf & rst!whatever : rst.movenext : loop
5. me!combo.recordsource = strLookup : me!combo.requery : set rst = nothing 

Replace the values as necessary above.

Does that make sense?

Max

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Wednesday, April 16, 2008 12:33 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Filter by Form stuff

I have on my form of interest a pair of combo-boxes that enable the user to
find stuff quickly. The form also has a set of buttons that invoke the
Filter-By-Form stuff. The former and latter parts work well, but not in
conjunction. I have written some code that examines the filter after the
Filter-By-Form stuff executes, and the results are weird. Everything begins
with "Lookup_*", where "*" refers to the controls you filled in while
addressing the Filter-By-Form form.

I need to deduce whatever filter the user applies and then re-scope the
"Finder" dropdowns to reflect this scope. I am at a loss for how to do this.
I already tried resetting the recordsouce and applying the filtered
statement and nothing I've come up with works.

Does anyone have a suggestion of how to accomplish this?

Buttons let the user describe a filter.
I need to re-scope the cbos to reflect the newly described filter (ie region
= 120 and distrcit = 02) When my debug code prints the filter it says
"Lookup_*" plus something.

I can parse this out using Replace() and that's trivial but I'm wondering
what the hell Access is doing behind the scenes that I don't comprehend.

TIA,
Arthur
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list