In another thread the forum helped me come up with the following SQL to allow the selection for one fantasy team or all fantasy teams.
Code:
Select "*" AS HLBID, "(All HLB Teams)" AS HLBName
FROM tblHLBTeams AS T1;
UNION
SELECT T1.HLBTeamID AS HLBID, T1.TeamName AS HLBName
FROM tblHLBTeams AS T1
ORDER BY HLBName;
This worked as desired by adding this criteria to the row source for the object list box (listPlayers)
Field: [HLBTeamID]
Table: [tblPlayers]
Criteria: Like [Forms]![frmCardByPosition]![listHLBTeam]
I then went to test the second list box (for MLB Teams) independently by removing the above row source criteria. I am using the SQL below for the list box listMLBTeam then the following criteria to transfer the selections made in listMLBTeam to listPlayers
Code:
SELECT "*" AS MLBID, "(All MLB Teams)" as MLBTeam
FROM tblMLBTeams AS T2;
UNION
SELECT T2.MLBTeamID AS MLBID, [T2.League] & " " & [T2.City] & " " & [T2.Club] AS MLBTeam
FROM tblMLBTeams AS T2
ORDER BY MLBTeam;
Field: [MLBTeamID]
Table: [tblPlayers]
Criteria: Like [Forms]![frmCardByPosition]![listMLBTeam]
The source list box, listMLBTeams, appears just as I would expect but the object list box (listPlayers) comes up blank. After much tweaking (brackets out and in, "T2" out and in, removing the concatenating calculated expression, etc., I am unable to make it work. This is the SQL for listPlayers.
Code:
SELECT tblPlayers.PlayerID, tblPlayers.NameLast, tblPlayers.NameFirst, tblPlayers.Year, tblMLBTeams.League, tblMLBTeams.City, tblMLBTeams.Club, tblPlayers.MLBTeamID
FROM tblMLBTeams INNER JOIN tblPlayers ON tblMLBTeams.MLBTeamID = tblPlayers.MLBTeamID
WHERE (((tblPlayers.MLBTeamID) Like [Forms]![frmCardByPosition]![listMLBTeam]))
ORDER BY tblPlayers.NameLast, tblPlayers.NameFirst;
Might the forum give this a look and help me find the mistake, big or small?