Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    May 2004
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Two Combos (Access 2000)

    Hello,
    I have a form with combo boxes on it. When the user selects or enters a value from / into the combo it passes the criteria to a query when a command button is selected. This all works great no problems at all. Now for the problem. The users would like to select from two combo boxes a range for the queries criteria. I not sure what info you will need and any help will be very much appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Two Combos (Access 2000)

    Assuming that you want to specify a range of values for a single field, you can use a condition like this in the criteria for that field:

    Between [Forms]![frmSelect]![cboFirst] And [Forms]![frmSelect]![cboLast]

    with the appropriate names for the form and combo boxes substituted. If this is not what you want, could you provide more detailed and specific information?

  3. #3
    Star Lounger
    Join Date
    May 2004
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Two Combos (Access 2000)

    Hans,
    As always thanks for responding so quickly. The expression you supplied is the route I orginally tried to go. Besides these two combos that would filter this one field there is also a couple more combo boxes that filter different fields. When I set the query criteria for the one field to be Between Forms![FormName]![ControlName1] AND Forms![FormName]![ControlName2] I for some reason have a problem with the selections by the other combos which filter other fields. Now what I was doing was

    Like Forms![FormName]![ControlName] & "*" OR Forms![FormName]![ControlName] Is Null on all of the fields I wanted the users to be able to filter. So, would all of the other combos work the same if I used the Between operator in my expression for the combos I would like a range for. I guess what I am trying to ask is would using the Between operator cause any problems that the Like operator would not?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Two Combos (Access 2000)

    What you describe should work. What problems do you have?

  5. #5
    Star Lounger
    Join Date
    May 2004
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Two Combos (Access 2000)

    When I put the Between operator into the expression for the two combo boxes(Range) and then select some criteria from another combo ( this combo passes criteria to a different field in the query) the criteria I selcted from the single combo is not passed to the query. If I then replace the Between operator with the Like operator the problems go away. Is there some order to the way the expressions need to be set up. i.e. the Between expression then the IS Null expression or IS Null expression and then the Between expression.When I use the Between operator in my querys expression it does work but for some reason the other combos wont pass criteria. I did check the names of the forms and controls to make sure there werent any typos. Agian any help is very much appreciated.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Two Combos (Access 2000)

    I don't understand. You should have the Between ... And ... condition in one column, and the Like ... Or ... Is Null in another column.

    If you can't get it right, you might post a stripped down copy of your database, so that Loungers can investigate the problem directly. See <post#=401925>post 401925</post#> for instructions.

  7. #7
    Star Lounger
    Join Date
    May 2004
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Two Combos (Access 2000)

    Hans,
    Yes sir I do understand that the Between....AND...condition is in one column and the Like .... condition is in another. I think I am probally just formating it wrong so I will try to work it out and if I cannot I would appreciate if I could do just as you said and post it so you can take a look at it. Thank you very much with the help and the quickness in which you delivered it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •