[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

08/17/2007 at 11:26AM PDT, ID: 22770456
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.8

Filter Form records shown using varCriteria

Asked by Ludique in Microsoft Access Database, Visual Basic Programming

Tags: access, filter, buildcriteria

I have an unbound form with 9 fields - 1 xext, 1xYes/No, 7xCombo boxes.  After extensive trawling though EE I decided to use the solution explained in http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_21582815.html by Harfang which I have amended (as far as I'm able) with my own specifics.  

When the user has entered/selected data (or not) and clicks the OK button I would like it to open the form frmPolicy which is based on the query forFrmPolicy.

The button to Clear the form before entering data works fine.  
However, on clicking OK I just get a message like:   ContactID=7 AND ProviderID=30 AND PolicyPrint=-1
Presumably indicating that it's got the selected data form the form but not doing anything with it.  Right?  

The solution feels so close I can almost smell it!  So what have I missed?
Here's my version of the code:

Option Compare Database

Option Explicit

Private Sub cmdClear_Click()
   ContactID = Null
   ProviderID = Null
   ProductID = Null
   PolicyStatusID = Null
   Kfdreference = Null
   PolicyFundFormatID = Null
   AdviserID = Null
   ParaplannerID = Null
   PolicyPrint = Yes
   ContactID.SetFocus
End Sub

Private Sub cmdQuery_Click()

    Dim varCriteria As Variant

    varCriteria = Null
        If Not IsNull(ContactID) Then _
        varCriteria = varCriteria + " AND " & BuildCriteria("ContactID", dbLong, ContactID)
    If Not IsNull(ProviderID) Then _
        varCriteria = varCriteria + " AND " & BuildCriteria("ProviderID", dbLong, ProviderID)
    If Not IsNull(ProductID) Then _
        varCriteria = varCriteria + " AND " & BuildCriteria("ProductID", dbLong, ProductID)
    If Not IsNull(PolicyStatusID) Then _
        varCriteria = varCriteria + " AND " & BuildCriteria("PolicyStatusID", dbLong, PolicyStatusID)
    If Not IsNull(Kfdreference) Then _
        varCriteria = varCriteria + " AND " & BuildCriteria("Kfdreference", dbText, Kfdreference)
    If Not IsNull(PolicyFundFormatID) Then _
        varCriteria = varCriteria + " AND " & BuildCriteria("PolicyFundFormatID", dbLong, PolicyFundFormatID)
    If Not IsNull(AdviserID) Then _
        varCriteria = varCriteria + " AND " & BuildCriteria("AdviserID", dbLong, AdviserID)
    If Not IsNull(ParaplannerID) Then _
        varCriteria = varCriteria + " AND " & BuildCriteria("ParaplannerID", dbLong, ParaplannerID)
    If Not IsNull(PolicyPrint) Then _
        varCriteria = varCriteria + " AND " & BuildCriteria("PolicyPrint", dbBoolean, PolicyPrint)


    MsgBox Nz(varCriteria, "No Criteria selected - All Records will be shown")

    'Exit Sub
   
    ' store into a query definition for later use:
    CurrentDb.QueryDefs("qselTemp").SQL = "SELECT * FROM forFrmPolicy" & " WHERE " + varCriteria & ";"
   
    ' open a report:
    ' DoCmd.OpenReport "rptPolicies", acViewPreview, WhereCondition:=Nz(varCriteria)

    ' filter an open form:
    Forms!frmPolicy.Filter = Nz(varCriteria)
    Forms!frmPolicy.FilterOn = Not IsNull(varCriteria)

End Sub



[+][-]08/17/07 11:44 AM, ID: 19719306

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/17/07 12:27 PM, ID: 19719639

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/07 12:36 PM, ID: 19719693

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/07 12:47 PM, ID: 19719766

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/07 03:20 PM, ID: 19720781

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Access Database, Visual Basic Programming
Tags: access, filter, buildcriteria
Sign Up Now!
Solution Provided By: 1William
Participating Experts: 1
Solution Grade: A
 
 
[+][-]08/17/07 05:44 PM, ID: 19721258

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/07 05:51 PM, ID: 19721269

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/07 06:03 PM, ID: 19721288

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/07 06:08 PM, ID: 19721300

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/17/07 06:10 PM, ID: 19721307

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/07 06:16 PM, ID: 19721318

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/17/07 06:18 PM, ID: 19721328

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/07 06:20 PM, ID: 19721332

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/17/07 07:59 PM, ID: 19721546

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08/18/07 03:18 AM, ID: 19722157

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/20/07 04:39 PM, ID: 19734578

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74 / EE_QW_2_20070628