Results 1 to 9 of 9
  1. #1
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Refer to listbox selection as query parameter (Access 2000)

    I think the subject about sums it up - I thought it would be something as simple as Like [forms]![formname]![list].column(#).... apparently not.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

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

    Re: Refer to listbox selection as query parameter (Access 2000)

    The way you refer to the list box is correct, if you keep in mind that numbering starts at 0, i.e. Column(2) is the 3rd column, etc.
    Also, this only works if formname is a main form. If the list box is on a subform, you have to use

    [Forms]![MainForm]![SubForm]![list]

    Using "Like" without a wildcard is equivalent to "=".

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

    Re: Refer to listbox selection as query parameter (Access 2000)

    Please attach stripped down & zipped copy.

  4. #4
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Refer to listbox selection as query parameter (Access 2000)

    I'm getting an error:
    __________________________________________________ ___________
    Undefined function 'Forms!frmlookup!lstpossibilities.column' in expression.
    __________________________________________________ ___________

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17>[i]I'm using the "*" as well...I was just too lazy to write it before <img src=/S/sorry.gif border=0 alt=sorry width=15 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

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

    Re: Refer to listbox selection as query parameter (Access 2000)

    Strange. Have to run now, will look at it later, if nobody else has.

  6. #6
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Refer to listbox selection as query parameter (Access 2000)

    Here it is.

    frmLookup is the form, lstNames (the larger listbox) is the one I'm having trouble applying the criteria to, lstPossibilities (the small one) is the one I'm using as the source.

    Please don't get too caught up in the pseudo-data. It's a very simple example, in reality I have approx. 8000 records, the vague filters will help.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  7. #7
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Refer to listbox selection as query parameter (Access 2000)

    Sure thing. Thanks <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  8. #8
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Refer to listbox selection as query parameter (Access 2000)

    Hi Jeremy,
    If you take out the Column reference does it work as you would like it to: i.e. Like [FORMS]![frmlookup]![LSTPOSSIBILITIES] & "*"

    I noticed there is only 1 column count and multi-select is set to none. I vaguely remember having a problem like this and if multi-select is set to none, then I had problems with referencing a column.
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

  9. #9
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Refer to listbox selection as query parameter (Access 2000)

    <img src=/S/hailpraise.gif border=0 alt=hailpraise width=27 height=22> Thanks Gary.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

Posting Permissions

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