Results 1 to 4 of 4
  1. #1
    testsubject is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    6

    Query can't pull parameter from combobox

    I have a query that searches a table for relavant data, that seems to be functioning properly on it's own. However I am trying to get it to pull data from a combo box as one of its parameters. Instead of it searching for the title in the combobox, it brings up the enter information popup, which defeats the purpose of the combobox.

    Here is the query in question, BookInfoTable is the table I am searching, BookSearchForm is the form where the combobox SelectTitle is located.



    Code:
    SELECT BookInfoTable.Title, BookInfoTable.Author, BookInfoTable.[ISBN 10], BookInfoTable.[ISBN 13], BookInfoTable.Format, BookInfoTable.Copyright
    FROM BookInfoTable
    WHERE BookInfoTable.Title=[Forms]![BookSearchForm]![SelectTitle]
    ORDER BY BookInfoTable.[Copyright];
    I have a suspicion that the issue is somehow involving the combobox row source is feeding the query multiple sets of information, but this was the only way I could get the combobox to work.

    The Row Source:
    Code:
     
    SELECT [BookInfoTable].[ID], [BookInfoTable].[Title] FROM BookInfoTable ORDER BY [Title];
    I have tried to get subinformation from the SelectTitle combobox, but it allways returns no results when I do.

    *Edit* I have also thought of making a hidden text box and trying to copy out whatever is selected from the combobox, but I think that would be more of a bandaid fix as opposed to doing it properly. I simply don't quite know how access works in some ways to get it done myself.


    Any help would be appreciated, thank you for your time.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is the form open when the query runs? It needs to be. If you're getting a parameter prompt, either the form isn't open or something is spelled wrong (form or combo name).

    Since you're looking for title instead of ID, make sure the bound column of your combo is 2, otherwise you'll be comparing ID to title.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    testsubject is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    6
    Thank you for your fast response!

    The form is open when it runs, as in theory the only way it should be accessible is when clicking on a command button below the combobox.

    I did have the wrong form listed in the one case, and haev corrected it. Now I only get an empty result(where I should get something, seeing as the user selected an option that is in the table as shown in the combobox).

    After checking the bound field, much to my dismay it was 1.

    So my problem is now solved.

    Thank you again, I'm just not as familiar with access, but I'm learning alot as I go along.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help! It would be more common to keep the bound column as 1 and change your criteria to look at the ID, but it works either way. Glad we got it working.

    Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 05-08-2013, 03:37 AM
  2. Parameter Query with Combobox?
    By Krs13 in forum Forms
    Replies: 3
    Last Post: 12-21-2010, 06:15 AM
  3. Only pull out curtain data from a query
    By mela in forum Queries
    Replies: 0
    Last Post: 12-08-2009, 12:20 PM
  4. Replies: 1
    Last Post: 02-14-2007, 07:27 PM
  5. Pull Parameter Value from Form
    By dymondjack in forum Queries
    Replies: 1
    Last Post: 02-14-2007, 07:15 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