Results 1 to 9 of 9
  1. #1
    Hidenite is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    2

    Talking Select value from a list box


    I need my query to ask you to select a name from a drop down list/list box (instead of asking you to type it in). It should look for the selectable name values in a specific table.

  2. #2
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Code:
    Select FROM YourTableName WHERE YourFieldName ='" & me.YourTextBoxName & "'"  ' if a string 
    Code:
    Select FROM YourTableName WHERE YourFieldName =" & me.YourTextBoxName   ' if an integer 
    Code:
    Select FROM YourTableName WHERE YourFieldName =#" & me.YourTextBoxName & "#"  ' if a date or time 

  3. #3
    Hidenite is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    2
    Thank you, though it didn't solve the problem.

    Where do I put the code? In a query design view? At least I tried that but resieved an error message saying, check the Syntax and bracket the sub query (or something like that).

  4. #4
    sesproul is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Posts
    50

    Design Question?

    Is your query run from a form, that has this Combobox on it with the recordsource set to the table with the list of values.?

    It sounds like you want them to select the option from the combobox first.

    Then what triggers the requery?

    Do they press a command button? or does it requery once the combobox is selected?



    Steve

  5. #5
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    On the combo box AfterUpdate event

    me.listboxname = "SELECT . . ." '(the appropriate SQL statement)
    me.listboxname.reuqery

  6. #6
    sesproul is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Posts
    50

    What do you want to have with the select Statement applied.

    After you make the selection in the Combo What exactly do you wish to have occur. I don't follow the assignment of the SQL statement in your example.


    Steve

  7. #7
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Look at my earlier post in this thread.

  8. #8
    sesproul is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Posts
    50
    I see what you mean with the ComboBox event. I was asking about the query itself. is it a recordsource, or simply being fired to preform some action independent of any GUI.


    steve

  9. #9
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    The original question wasn't mine.

    A SQL query, among other things, can be a form or report recordsource or a control rowsource.

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

Similar Threads

  1. 2 multi select list boxes on one search form
    By woodey2002 in forum Forms
    Replies: 2
    Last Post: 11-05-2010, 12:44 PM
  2. Can't alays select an item from a list box
    By bomber in forum Access
    Replies: 0
    Last Post: 10-16-2009, 10:01 AM
  3. Replies: 8
    Last Post: 09-24-2009, 02:56 PM
  4. Replies: 1
    Last Post: 03-01-2009, 09:53 AM
  5. Replies: 1
    Last Post: 02-25-2009, 07:29 PM

Tags for this Thread

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