Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2004
    Posts
    30

    Unanswered: ANDOR query PLEASE HELP

    I have a form which has a query subform in it, the subform refreshes based on unbound columns above it. The query is supposed to operate like this:

    criteria=combobox1

    or

    criteria=combobox1 and combobox2

    or

    criteria=combobox1 and combobox2 and combobox3

    Appearently the query is not capable of handling this alone, but maybe I dont know something...can anyone help me?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Use paranthesis.

    criteria = (combobox1) or (combobox 1 and combobox2) or (combobox1 and combobox2 and combobox3)

    Note that you have to restate the operator each time...

    eg:

    criteria = (someField = cbo1) or (someField = cbo1 AND someField = cbo2) etc etc
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jun 2004
    Posts
    30
    Thanks for the reply Teddy. I tried to implement what you had said, I had thought of this before but wasnt sure if I did it right, but the problem with that statement is after I select combobox1 the data shows up correctly, but when I select combobox2 the data is still the same as when I selected combobox 1 alone. And it is the same when I select all 3 comboboxes...access doesnt seem to have the intelligence to figure out that if I have 2 comboboxes selected that I want the query to show the results for the criteria of combobox1 AND combobox2, instead it keeps querying the combobox1 statement alone and outputting the result. Do you have any other suggestions?

  4. #4
    Join Date
    Jun 2004
    Posts
    16
    Try putting the concantenated value of all 3 combo boxes in a 4th unbound text box. Then reference the text box in your query.

  5. #5
    Join Date
    Jun 2004
    Posts
    92
    Or a thought, create a function and take the function results and use as the criteria.

  6. #6
    Join Date
    Jun 2004
    Posts
    30
    "You can lead a horse to water, but you cant teach him how to drink"

    I appreciate the suggestions and feedback from everyone here...but either I dont know how to drink and need to be taught, or I am just 3/4 of the way there and just need that other quarter to get over the top. I could make a test case for someone to help explain a solution to me, or maybe to better explain my problem. I am fairly new to access, and I am learning as I go along. When you say make a function and call it in your query, I dont know where to begin, although I dont see how its a lot different from trying to do it through a straight sql statement. In a similar note, is there any good websites for learning relatively things that are relatively advanced? Every time I search for a tutorial on the internet I come up with websites that teach you "how to create a table, how to use the query wizard" etc and I feel my lack of knowledge to be a burden to people on here, like I am asking too stupid questions. I will post a test case this evening after I have done reformatting my home computer because windows sucks ...I am making the transition to linux, still keeping a windows partition, but I wont have access to access until after I am done. Thanks for all your help guys, if anyone can in the meantime post an explanation to this problem that a small child would understand I would be very greatful.

Posting Permissions

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