Running a parameter query with input from a form's combo box.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • James0192
    New Member
    • Jan 2014
    • 4

    Running a parameter query with input from a form's combo box.

    I am trying to run a parameter query that returns results based upon the input in a form's combo box on a form. I would like it so that the user selects an option from the combo box, presses a button and results are returned based upon that.

    now as I understand it in the criteria field in the correct column should read:

    [Forms]![FormName]![ComboName]

    but this doesn't work.

    I've tested it with a textbox instead using:

    [Forms]![FormName]![TextboxName]

    and that works but with a combo box it doesn't.
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    When you say it doesn't work, what do you mean?

    Do you have the bound column of the combobox set correctly?

    The bound column is the value that will be returned from the rowsource property. If it is blank, then your combobox is returning nothing. You need to have it set to the column of data that is required in your query.

    Keep in mind, CONTROL SOURCE is NOT the same as ROW SOURCE in a combo/list box. Normally the two are only related in that the bound column of the ROW SOURCE must return a value that is of the correct typecast as the field to which the cbo's CONTROL SOURCE is set (bound).

    There is another method with multi-column record sources that you could use read thru this: How to select Records in an Access Subform from a Combo Box it's a bit of an overkill so don't worry if you don't follow somehthing, just ask back here and we'll clear it up (^_^)
    Last edited by zmbd; Jan 22 '14, 05:10 PM.

    Comment

    • James0192
      New Member
      • Jan 2014
      • 4

      #3
      Thanks for that. The bound column was set wrong hence it wasn't returning the right thing.

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        I love the simple fixes... (^_^)

        BOL
        -z

        Comment

        Working...