Results 1 to 6 of 6
  1. #1
    Kimmie is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Oct 2010
    Posts
    3

    Unhappy Parameter Query doesn't work

    Ok, I am completely new to MS Access. I took one class on databases and it was the basics. I am trying to create a parameter query that uses three tables. I am selecting questions based on their source and/or their historical era. This is the SQL that I have so far. It will retrieve info only if I use both the Source and the Historical Era, but not if I only choose one. If anybody could give me any help, I would appreciate it.




    PARAMETERS [Source ] Text ( 255 ), HistoricalEra Text ( 255 );
    SELECT Answer.AnswerText, Answer.CorrectAnswer, [Historical Era].HistoricalEra, Question.QuestionText, Question.NationallyValidated, Source.Source
    FROM (Source INNER JOIN ([Historical Era] INNER JOIN Question ON [Historical Era].[HistoricalEraID] = Question.[HistoricalEraID]) ON Source.[SourceID] = Question.[SourceID]) INNER JOIN Answer ON Question.[QuestionID] = Answer.[QuestionID]

    WHERE (((Source.Source)=[Source]) AND ((Historical Era.HistoricalEra)=[HistoricalEra]))
    OR (((Historical Era.HistoricalEra)=[HistoricalEra]) AND (([Source]) Is Null))
    OR (((Source.Source)=[Source]) AND (([HistoricalEra]) Is Null))
    OR ((([Source]) Is Null) AND (([HistoricalEra]) Is Null));


    Kimmie

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    Do you know you can create a query in "Design View"?
    Or you can create a query using Query Wizard?

  3. #3
    Kimmie is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Oct 2010
    Posts
    3
    Actually I started with the query wizard and then went into the design view. I got this far by searching different forums like this one. I have this query working with this SQL in another database, but that database has all of the fields in one table. Now that I have split the fields into three separate tables the query doesn't work. Perhaps that is the problem. It has more to do with the way the tables are joined?
    Kimmie

  4. #4
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I think you got problem with the syntax of join and the parameter's name, try to change the name to different with SOURCE or HistoricalEra because they the fields' names.

  5. #5
    Kimmie is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Oct 2010
    Posts
    3
    Your not going to believe this, but I just got it to work. I was just making a few changes in design view. Thank you for responding to this post.

  6. #6
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    Congratulations

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

Similar Threads

  1. Query to work as a Vlookup function
    By dharmik in forum Queries
    Replies: 21
    Last Post: 01-04-2012, 08:12 AM
  2. Query doesn't work the day after
    By sithis876 in forum Queries
    Replies: 1
    Last Post: 07-13-2010, 07:11 AM
  3. Query doesn't work when launched by code
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-24-2009, 09:52 AM
  4. Replies: 0
    Last Post: 02-27-2009, 01:39 PM
  5. Nested IIf query will not work
    By ddog171 in forum Queries
    Replies: 1
    Last Post: 06-20-2006, 02:03 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