+ Reply to Thread
Results 1 to 3 of 3

List box ' VBA

  1. #1
    Registered User
    Join Date
    09-09-2005
    Posts
    7

    List box ' VBA

    Please help me a new user on how to create a list box on a worksheet,
    pass the selection to a query in VB.

    For example:

    In this query select name from x where y > 1000

    I need to be able to select the "name" from the list box and pass it to the query. The pupose is to be able to dynamically select items in the database at random

    Also, how do I do the second part? If I type y > 1000 can that sting be passed to the query? How is that done and what is the syntax ... specially on the VB side?

    Any help will be much appreciated.

    Thanks in advance,

    ~Anusha

  2. #2
    Tom Ogilvy
    Guest

    Re: List box ' VBA

    Why not use the Autofilter or the Advanced filter under the data menu.
    (assuming you are querying data on a worksheet)

    --
    Regards,
    Tom Ogilvy

    "Anusha" <Anusha.1v3pun_1126285534.8961@excelforum-nospam.com> wrote in
    message news:Anusha.1v3pun_1126285534.8961@excelforum-nospam.com...
    >
    > Please help me a new user on how to create a list box on a worksheet,
    > pass the selection to a query in VB.
    >
    > For example:
    >
    > In this query select name from x where y > 1000
    >
    > I need to be able to select the "name" from the list box and pass it to
    > the query. The pupose is to be able to dynamically select items in the
    > database at random
    >
    > Also, how do I do the second part? If I type y > 1000 can that sting
    > be passed to the query? How is that done and what is the syntax ...
    > specially on the VB side?
    >
    > Any help will be much appreciated.
    >
    > Thanks in advance,
    >
    > ~Anusha
    >
    >
    > --
    > Anusha
    > ------------------------------------------------------------------------
    > Anusha's Profile:

    http://www.excelforum.com/member.php...o&userid=27119
    > View this thread: http://www.excelforum.com/showthread...hreadid=466314
    >




  3. #3
    Registered User
    Join Date
    09-09-2005
    Posts
    7

    List Box and VB

    I orchestrated my first VB yesterday... So I am a novice.

    I am not sure what you mean... I have used filter and wuto filter before, but how do I incoroprate it into my VB code so it is automated.

    Currently I manually pull data via ODBC

    For eg. select x from Y where z > 1000 and dt = 20041231

    What I want to be able to do is to input x and z > 1000 and pass it to the query t run.

    I was able to this with the dt = part yesterday where I pass in the date. And that took a whole day.

    I am not sure how to do the rest.. like being able to select a item frm a list and have it represent x.

    Thanks in advance.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1