Results 1 to 9 of 9
  1. #1
    akingsley is offline Novice
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    7

    List box with operators

    Hi -



    I need to create a list box with operators and I'm having difficulty figuring out how to tell access that greater than = > and less than = < and or = or and so on.

    If any one has any ideas it would be greatly appreciated.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    what are you using it for? generally, this is used on a search form and the like, and 3 combos are used, whereby you have one with a value, one with the operator and one with the criteria.

  3. #3
    akingsley is offline Novice
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    7
    Hi -

    Yes thats exactly what i am using it for.

    Here is the form i have setup so far:


  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    well that's great, but what exactly IS the problem? with that many lines of criteria, you're definately going to want to name your controls with some sort of convention that is conducive to a vba loop, otherwise it'll be a mess.

    btw, that looks like a large screen. is that a computer? my development machine is actually a 40" TV screen. =)

  5. #5
    akingsley is offline Novice
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    7
    The problem is I don't know how to tell Access that "is greater than" = >, "is less than" = < and so on.

    Ha my monitor is slightly smaller than yours. That was a print screen from my laptop with a 13" screen.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Were the methods posted for you yesterday at UA not working? If not, you might want to post a follow up there so they can refine their answers.

    cross posters
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by akingsley View Post
    The problem is I don't know how to tell Access that "is greater than" = >, "is less than" = < and so on.

    Ha my monitor is slightly smaller than yours. That was a print screen from my laptop with a 13" screen.
    You need to use either a select case statement of a simple if/else to check that particular dropdown to convert the "is equal to" to a "=" sign in the actual code. in a vba string, if an input string is not part of an evaluation, you can concatenate directly with the ampersand. such that:
    Code:
    dim strOp as string
    
    select case me.cboOperator
       case "is equal to"
          strop = "="
       case "is less than"
          strop = "<"
       case else
          strop = ">"
    end selct
    
          sql = "SELECT * FROM TABLE WHERE "
    
    sql = sql & "[field]" & strop & me.cboCriteria
    
    currentdb.execute sql
    make sense?

    and I didn't know you were on UA too. If I would've seen that, I would've have answered you. That's a waste of time for people who answer. I'm not a part of UA because I dislike their thread structure. it's so difficult to read anything there! Not only that, but things are so specialized that they have like 50 different forums. makes it extremely time consuming to find general info on something.

  8. #8
    akingsley is offline Novice
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    7
    Ok thanks! I'll try that.

    I have dug through several threads on several forums to try to figure this out without any luck so I figured I'd try to double my chances and by posting both places.

    I have honestly have spent hours and hours trying to get this one stupid form to work properly.

    Last time i tried to get help people just kept telling me to use the mutiselect combo boxes which did not work for my purposes.

  9. #9
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by akingsley View Post
    Last time i tried to get help people just kept telling me to use the mutiselect combo boxes which did not work for my purposes.
    Word to the wise: the best way to help yourself is to read documentation. Not saying anything bad about forums, but free advice is always just that, FREE. Best not to ever expect anything from it. Just a tip to live by, in my view anyway.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-22-2010, 10:11 AM
  2. Input data from one list box to another list box
    By KellyR in forum Programming
    Replies: 0
    Last Post: 06-04-2010, 11:24 AM
  3. Replies: 3
    Last Post: 03-25-2010, 12:31 PM
  4. Adding Mathematical Operators to my QBF
    By Silver Rain 007 in forum Queries
    Replies: 1
    Last Post: 11-05-2009, 08:54 AM
  5. List box to populate other list boxes
    By Nathan in forum Forms
    Replies: 0
    Last Post: 03-03-2009, 07:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums