Results 1 to 8 of 8
  1. #1
    axman1000 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    13

    How to use a combo box value as part of a query which is a report source?

    Hi! I'm new to this forum and new to MS Access too, so please bear with me



    I have created a query which is the source of a report. The WHERE clause in the query is a value in the combo box, given as Combo.Text. The combo box's source is a column from a table and I'm not storing this value anywhere and had used the "Remember this value for future use" option which is provided when creating the combo box. When I select an option from the combo box, instead of opening the custom report, a popup which says prompts me for the parameter opens, and when I type the value, it generates the report, but I want it to generate it on the click of the button after I select the option from the combo box. How can I do this?

    The query is as follows:
    Code:
    SELECT Table_1.Hotel_Name, Table_2.Name_of_Delegate, Table_2.Address, Table_2.City, Table_2.Center, Table_2.Spouse_Present, Table_2.No_of_Children, Table_2.No_of_Guests, Table_2.No_of_Rooms
    FROM Table_1 INNER JOIN Table_2 ON Table_1.ID=Table_2.Hotel_of_Residence
    WHERE Table_1.Hotel_Name=Form.Form1.Combo10;

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    The reason for the prompt is because it doesn't recognize Form.Form1.Combo10. This is the incorrect syntax. Replace that with Forms!Form1!Combo10 and it should pull from the combobox and do what you want.

  3. #3
    axman1000 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    13
    Thank you! That did get rid of the popup, but now, the reports are blank! At least, with the popup, the report would be generated, but now, all it opens is a blank report. What next?

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    First check to see if the combobox being referenced actually contains a value. If it does, run the query by itself to see if it pulls the correct data.

  5. #5
    axman1000 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    13
    Like I said, it's an unbound combo box and while creating it, I had used the Remember value for later use option, so what do I do now?

  6. #6
    axman1000 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    13
    Also, could you please help me with this question? Thanks!

  7. #7
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    The remember value option won't help in this case. if the form is not open and the combox doesn't have something in it, the query won't work right. So if you have the form open and there is a value in it, and it still doesn't display properly, keep the form open, and open the query and see if it works properly. If it does, then there is something wrong with the report. If it doesn't, then, outside of a typo, I have no idea what it could be.

    I saw that other thread. Not sure I can help you with that one.

  8. #8
    axman1000 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    13
    Thank you for helping me this much! I'll redo and see what I can come up with Please do spread the word about the other question, if you know anyone who can help. Thanks!

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

Similar Threads

  1. Replies: 1
    Last Post: 03-01-2011, 03:04 PM
  2. Unmatched query to lookup part of the field
    By DMetcalfe in forum Queries
    Replies: 15
    Last Post: 10-08-2010, 05:30 AM
  3. Replies: 7
    Last Post: 09-24-2010, 07:23 AM
  4. Query A part description /name
    By wvswede in forum Queries
    Replies: 5
    Last Post: 04-07-2010, 06:07 AM
  5. Replies: 2
    Last Post: 12-09-2005, 01:58 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