Results 1 to 2 of 2
  1. #1
    gazzieh is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    26

    Query Failing When No Data

    I have a query that works based upon a form selection. The query works when I select an item in all of the relevant combo boxes but if I do not select one option I get an error stating that the query expression is too complicated.

    The SQL looks like this:



    Code:
    SELECT tbl_exam_board.exam_board_id, tbl_specification.specification_id, tbl_unit.unit_id, tbl_topic.topic_id, tbl_exam_paper.exam_paper_id, tbl_question.question_id, tbl_question.txt_question_number
    FROM tbl_topic INNER JOIN ((((tbl_exam_board INNER JOIN tbl_exam_paper ON tbl_exam_board.exam_board_id = tbl_exam_paper.exam_board_id) INNER JOIN tbl_specification ON tbl_exam_board.exam_board_id = tbl_specification.exam_board_id) INNER JOIN tbl_question ON tbl_exam_paper.exam_paper_id = tbl_question.exam_paper_id) INNER JOIN tbl_unit ON tbl_specification.specification_id = tbl_unit.num_specification_id) ON (tbl_unit.unit_id = tbl_topic.num_unit_id) AND (tbl_topic.topic_id = tbl_question.topic_id)
    WHERE (((tbl_exam_board.exam_board_id)=[forms]![frm_switchboard].[drpdwn_exam_board]));
    So, how do I get this to work so that the user can opt to leave a combo box empty and the query therefore treat this combo box as being *?

  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,641
    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: 13
    Last Post: 11-14-2013, 04:13 PM
  2. Failing to grasp the syntax of a Union Query
    By brharrii in forum Queries
    Replies: 6
    Last Post: 05-09-2013, 11:51 AM
  3. Double dlookup failing
    By JeroenMioch in forum Programming
    Replies: 3
    Last Post: 02-07-2013, 01:50 PM
  4. Updateable query failing in Runtime - 2010
    By ChefContainer in forum Queries
    Replies: 1
    Last Post: 02-05-2013, 07:29 PM
  5. Append to SQL table failing on data type
    By tpcervelo in forum Queries
    Replies: 2
    Last Post: 10-13-2011, 12:07 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