Results 1 to 4 of 4
  1. #1
    rhubarb is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76

    Passing parameter from form to query

    I have a form where the user selects a filter, then a combo box below that limits the results to said filter. Say the filter is employees, my (lstTicketFilter) filter combo box below will drop-down and show all employee names.


    That works fine. When I select the preview button to open my report for this filter it asks for a parameter lstTicketFilter, despite it being selected in the form.

    So I open my report, and the record source is my query which pulls all corresponding date to the employee name. If I remove the record source query and replace it with the contents of the same query the report pulls fine.

    Another question would be does it matter if I keep my query contents (some of it is very long) in the record source of my report? Is there an argument to just replace it with a query? I feel like the latter is cleaner but why isn't my form passing the query the parameter selected in the form?


    Thanks for any help!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by rhubarb View Post
    ...Is there an argument to just replace it with a query?...

    Use the name of your query object in the Record Source property of your report. Use the pulldown to select the correct Object Name. It may be easier to edit a Query Object vs. editing the SQL syntax within the RecordSource property field.

    It appears your SQL that is in your Report's RecordSource has incorrect syntax. Perhaps the form name defined within the SQL is misspelled.

    Also, make sure you are using a combo and not a multiselect listbox for your parameterized query. Applying the values from a multiselect listbox takes a little bit of effort.

  3. #3
    rhubarb is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    76
    I resolved. My WHERE clause reference to report had typo! This caused the parameter prompt. Thanks for the help!

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You bet. Glad you sorted things out and posted your solution.

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

Similar Threads

  1. Passing textbox value into sql query parameter
    By gustavoavila in forum Access
    Replies: 7
    Last Post: 04-23-2014, 04:00 PM
  2. Replies: 1
    Last Post: 01-24-2012, 12:47 AM
  3. Parameter Passing
    By Juan4412 in forum Queries
    Replies: 1
    Last Post: 11-21-2011, 10:23 AM
  4. Replies: 10
    Last Post: 09-27-2010, 08:06 PM
  5. Macro passing a parameter
    By SlowPoke in forum Access
    Replies: 1
    Last Post: 09-26-2010, 09:57 PM

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