Page 2 of 2 FirstFirst 12
Results 16 to 30 of 30
  1. #16
    JohnLouisWood is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    52
    When I tried SWITCH in the (sub)report for the source I got an error message telling me that I had to select a (1) table or query for my source.

  2. #17
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    That is what I said in post #14...
    Can you show the query with the left join (a screen shot, not SQL)?
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #18
    JohnLouisWood is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    52
    Click image for larger version. 

Name:	Screenshot (36).jpg 
Views:	15 
Size:	104.8 KB 
ID:	50025Click image for larger version. 

Name:	Screenshot (37).jpg 
Views:	15 
Size:	121.4 KB 
ID:	50026

    Here are 2 screenshots: First SQL:
    SELECT Min(A.Tot_ws) AS Tot15ws, Min(A.Mx_cws) AS Mx_cws, Count(B![CountY]) AS Cnt_Mx, Min(B.FallY) AS Fir_Fall, Min(C.FallY) AS 2nd_Fall, Max(C.FallY) AS 5th_Fall, Max(B.FallY) AS Lst_Fall, Min(B.FallN) AS Fir_End, Min(C.FallN) AS 2nd_End, Max(C.FallN) AS 5th_End, Max(B.FallN) AS Lst_End
    FROM Res_15cws_v3_Query AS A, Res_15cws_v2_Query AS B LEFT JOIN Res_15cws_v2_3_Query AS C ON B.[Cws_ID] = C.[Cws_ID]
    WHERE (((B.CountY)=[A].[Mx_cws]))
    GROUP BY A.Tot_ws, A.Mx_cws;
    and Second SQL:
    SELECT Min(A.Tot_ws) AS Tot15ws, Min(A.Mx_cws) AS Mx_cws, Count(B![CountY]) AS Cnt_Mx, Min(B.FallY) AS Fir_Fall, Min(C.FallY) AS 2nd_Fall, Max(C.FallY) AS 5th_Fall, Max(B.FallY) AS Lst_Fall, Min(B.FallN) AS Fir_End, Min(C.FallN) AS 2nd_End, Max(C.FallN) AS 5th_End, Max(B.FallN) AS Lst_End
    FROM Res_15cws_v3_Query AS A, Res_15cws_v2_Query AS B INNER JOIN Res_15cws_v2_3_Query AS C ON B.[Cws_ID] = C.[Cws_ID]
    WHERE (((B.CountY)=[A].[Mx_cws]))
    GROUP BY A.Tot_ws, A.Mx_cws;
    The only difference Second SQL has INNER join while First SQL has LEFT join. I tried LEFT OUTER join - same result.

  4. #19
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Please show the design view of the query with the left join (before you attempt to run it).
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #20
    JohnLouisWood is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    52
    Click image for larger version. 

Name:	Screenshot (38).jpg 
Views:	12 
Size:	152.0 KB 
ID:	50028Click image for larger version. 

Name:	Screenshot (39).jpg 
Views:	13 
Size:	147.8 KB 
ID:	50029Click image for larger version. 

Name:	Screenshot (40).jpg 
Views:	13 
Size:	142.6 KB 
ID:	50030That's what I had planned also.

  6. #21
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Can't see the join from A to B? Does A return just one record? Save the A and B as a separate query then build the final one based on that and add C with the left outer join.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  7. #22
    JohnLouisWood is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    52
    There is no join between A and B.
    Just a moment ago when I tried to close Res_15cws_v5_LJ_Query, it would not let me close until I had changed to INNER JOIN or no join at all.
    I had to go back in (Res_15cws_v5_Query) and remove the join between B and C in order to get all 4 values that I had/needed from FallY. The INNER JOIN restricted the records to only 2. I'm thinking actually eliminated my first and last values.
    This scares me, in that I know that there are other queries - from the past that I used LEFT JOIN. Will these now be corrupted/not able to function/wrong results?

  8. #23
    JohnLouisWood is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    52
    I would send you my complete database to the forum, but when I tried previously it was WAY too large.

  9. #24
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    The lack of join between A and B is the reason you cannot have the left join. So please try what I suggested in the previous post (create an intermediary query with just A and B then use that to build the final one by adding C with the left join pointing towards it).
    If you want to send me the db please zip it and upload it here or to my email on my website.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  10. #25
    JohnLouisWood is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    52
    Query A has no common fields with B or C. I did LEFT JOIN B and C as a query v5_1, and then added Query A to make v5_2, and it seems to work fine.
    I also set a zipped file of my database to your e-mail.

  11. #26
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    That's great, that is what I meant, you need to either group A and B then C or B and C then A to avoid having a mix of no join/left join in the same query.
    Please let me know if you still want me to look at your file.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  12. #27
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Edit: deleted - duplicate post
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  13. #28
    JohnLouisWood is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    52
    Thank you very much!! At this point I am good. Later I will use this set of queries as templates for the other queries and sub-reports. Again thank you very much for your help.

  14. #29
    JohnLouisWood is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    52
    I'm finding that by doing the LEFT JOIN first, that I can then have the blank fields. This will mean that (I think) I will be able to look (My sub-report) at a single query whether printing a season, or several seasons, or several consecutive seasons. Because of my switch statements. I was having a problem because my switch statement was causing ACCESS to look for values of that the report was not using.
    Hopefully this will make ACCESS happy.

  15. #30
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 05-22-2018, 07:47 AM
  2. Finding a percentage
    By espinobj in forum Queries
    Replies: 3
    Last Post: 06-29-2017, 01:20 PM
  3. Finding MAX with its details
    By samuelitz in forum Queries
    Replies: 1
    Last Post: 02-25-2016, 04:48 AM
  4. Finding Records that are not there!
    By TrudyD1474 in forum Queries
    Replies: 2
    Last Post: 06-18-2010, 04:41 PM
  5. finding a value in a recordset
    By TheShabz in forum Programming
    Replies: 9
    Last Post: 04-23-2010, 02:44 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