Results 1 to 8 of 8

Thread: list box query

  1. #1
    Join Date
    Oct 2009
    Posts
    4

    Unanswered: list box query

    I have a table named "tblantennadatanodups" that has fields "tagid", "date"," time" and "number of fish". I also have a user interface where a lsit box is present with tagids.Please help me with the sql query to display the row containing the tagid when the user clicks on any id.

    I have written the code which pops up a dialogue box for the user to enter the tagid and when he enters it will direct to the table and displays the row.

    SELECT tblAntennaDataNoDups.TAGID, tblAntennaDataNoDups.DetectDate, tblAntennaDataNoDups.DetectTime, tblAntennaDataNoDups.Antenna
    FROM tblAntennaDataNoDups
    WHERE ((tblAntennaDataNoDups.TAGID)=[Me].[TAGID]);

    Instead i want to directly display the record upon mouse click. please help.

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    Welcome to the forums

    Have a look at this tutorial on listboxes, see if it helps you.

    Also, I would strongly suggest you change your field names, as some are Access Reserved Words and in general will cause you trouble in the long run. I would suggest using a good naming convention and sticking to it (Commandment 3 ).
    Last edited by nckdryr; 10-19-09 at 00:09.
    Me.Geek = True

  3. #3
    Join Date
    Oct 2009
    Posts
    4
    Thanks for the reply. I tried looking at your list boxes tutorial. It was helpful in making the multiselect listbox and also i could redirect to query. But i want to pass the value selected by the user from the list box to the query so that a record from a table is displayed based on the tagid selected.

  4. #4
    Join Date
    May 2005
    Posts
    1,191
    Quote Originally Posted by vineet36
    i want to pass the value selected by the user from the list box to the query so that a record from a table is displayed based on the tagid selected.
    The aforementioned article shows you how to do just that, keep reading to about 4/5 of the way down. If you still need help building SQL in VB based on user-input via controls, have a look at this other Martin Green Lecture.
    Me.Geek = True

  5. #5
    Join Date
    Oct 2009
    Posts
    4
    Thanks a lot i figured out that one. Do u have a tutorial on text boxes too. Please help me with that.

  6. #6
    Join Date
    May 2005
    Posts
    1,191
    What do you need to know about text boxes? They're pretty straightforward; they have a single value, some format stuff and some events, about as basic as it gets for a standard control.
    Me.Geek = True

  7. #7
    Join Date
    Oct 2009
    Posts
    4
    Well i have a table with column names start date and end date. I created 2 text boxes where the user can enter start date and end date then upon pressing enter it should open all the records from the table in between those dates.

  8. #8
    Join Date
    May 2005
    Posts
    1,191
    See the link in post #4 along with setting recordsource properties.
    Me.Geek = True

Posting Permissions

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