Filtered Combo Box Results

W

Wayne Emminizer

I have a form with about 40 combo boxes that based on the
selection made use VBA code to apply a filter to 31,000
records that are in the subform. That works perfectly.
No what I need to do is filter the available choices that
display in the combo box to just the values that
correspond to the filtered records in the subform. I
just can't seem to figure out the best solution. If
there were only 5 or 6 combo boxes I would handle it in
the query or in the rowsource itself. Please advise.
Thanks

Wayne
 
P

prabha

Hi Wayne,

40 combo boxes you would like to change ... WOW!!

Why not this (don't know what type of performance hit you will encounter
though):

- Create a textbox control (not visible) on Form that has the values for
the WHERE Clause for your combo boxes (e.g., "ALFKI")

- When you initially open the Form the Combo boxes will be filtered based
on that value

- After applying your Filter to your SubForm (I guess you are using VBA)
then change the value in the invisible textbox control (e.g., change
"ALFKI" to "ANTON") and requery the combo box controls. Example:
Function YourFunction()
' your code to filter the subForm

Dim i As Integer

' set value of textbox to ANTON
from ALFKI
Me.TextboxUnbound1 = "ANTON"

' loop thru all controls on Form
' assumption is you want to
requery ALL combo boxes
For i = 0 To Me.Count - 1
If TypeOf Me(i) Is ComboBox
Then
Me(i).Requery
End If
Next i
End Function

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."



--------------------
| Content-Class: urn:content-classes:message
| From: "Wayne Emminizer" <[email protected]>
| Sender: "Wayne Emminizer" <[email protected]>
| Subject: Filtered Combo Box Results
| Date: Tue, 17 Feb 2004 15:07:11 -0800
| Lines: 12
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcP1qsY048H3cLhJRZWw+Yea6dowAA==
| Newsgroups: microsoft.public.access.formscoding
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.access.formscoding:220940
| NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| I have a form with about 40 combo boxes that based on the
| selection made use VBA code to apply a filter to 31,000
| records that are in the subform. That works perfectly.
| No what I need to do is filter the available choices that
| display in the combo box to just the values that
| correspond to the filtered records in the subform. I
| just can't seem to figure out the best solution. If
| there were only 5 or 6 combo boxes I would handle it in
| the query or in the rowsource itself. Please advise.
| Thanks
|
| Wayne
|
 

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