Hi Lou,
What this sample code attempts to do is to Filter the Form based on
selection of Combo boxes:
Me.Filter = Left(strWhere, lngLen)
Me.FilterOn = True
An example of what would happen is
- Form based on 100 records
- User selects value in combo box [projects]
- User selects value in combo box [engineer]
- User selects value in combo box [completedate]
- Based on what was selected Form now displays 35 records
Is that what you are attempting?
Regards,
Eric Butts
Microsoft Access Support
(e-mail address removed)
"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."
This posting is provided "AS IS" with no warranties, and confers no rights
--------------------
| Content-Class: urn:content-classes:message
| From: "Lou" <
[email protected]>
| Sender: "Lou" <
[email protected]>
| References: <
[email protected]>
<#W#P#x#
[email protected]>
| Subject: RE: Filter using multiple combo box
| Date: Tue, 17 Aug 2004 06:33:46 -0700
| Lines: 42
| 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: AcSEXtJWGpYi3XRXT4KjC/RGGU+hwA==
| Newsgroups: microsoft.public.access.formscoding
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.formscoding:242434
| NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Eric,
| Thank you for the suggestion, I tried this but it is not
| what I am exactly looking for. The code below is what I
| am working with now. The problem that I have run into
| with this code is when I filter by [project] and then try
| to sort by the next combo box [engineer] it sort all the
| records and not just by the results of the [project]
| sort.
| I found this code in the newsgroup sometime ago and I am
| not able to find it again. I remember the creator saying
| that you should be able to use multi fields to sort by,
| but I have had no luck.
| Thanks again Lou
| Dim strWhere As String
| Dim lngLen As Long
| Me.Refresh
| If Me.Dirty Then 'Save before filter
| Me.Dirty = False
| End If
|
| If Not IsNull(Me.cmbprojectsort) Then
| strWhere = strWhere & "([project_name] = """ & _
| Me.cmbprojectsort & """) AND "
| End If
|
| If Not IsNull(Me.cmbcontactsort) Then
| strWhere = strWhere & "([vwcontact] = """ & _
| Me.cmbcontactsort & """) AND "
| End If
|
| 'etc for other search boxes.
|
| lngLen = Len(strWhere) - 5 'Without trailing "
| AND ".
| If lngLen <= 0 Then
| MsgBox "No criteria."
| Else
| Me.Filter = Left(strWhere, lngLen)
| Me.FilterOn = True
|
| End If
|
|