Okay, here is what I've got after a few days of trial and error (and one persistent bug):
tblStockHeader = Stock_ID (auto# pk), Card_Year, Brand, Subset
tblStockPlayer = SPlayerID (auto# pk), Stock_ID, Player_Name
tblPlayerHeader = Player_ID (auto# pk), Player_Name, DoB
tblPlayerAttributes = PAttr_ID (auto# pk), Player_ID, PAttr_Desc
2 Forms are:
frmStockHeader = tblStockHeader with subform frmStockPlayer where Stock_ID carries through. Logic is a card can have multiple people on them so each is it's own record line.
frmPlayerHeader = tblPlayerHeader with subform frmPlayerAttributes where Player_ID carries through. Logic is Cal Ripken can have 2+ attributes such as Hall of Fame and 3000 Hits plus other.
I have set up a module using the same syntax from the link you provided about joining in a non-union format. Here is that code:
'Combination returns a list of the attributes so far found for the current ID.
- Public Function Combination(strID As String, strAttribute As String) As String
-
-
Static strLastID As String
-
Static strAttributes As String
-
-
If strID = strLastID Then
-
strAttributes = strAttributes & "/" & strAttribute
-
Else
-
strLastID = strID
-
strAttributes = strAttribute
-
End If
-
Combination = strAttributes
-
-
End Function
When I do a query based on combining all the players associated with 1 Stock_ID, I get the information as it should be. That SQL is this:
- SELECT tblStockPlayer.Stock_ID, Max(Combination([Stock_ID],[Player_Name])) AS Players
-
FROM tblStockPlayer
-
GROUP BY tblStockPlayer.Stock_ID;
This gives me Stock_ID --- Player 1/Player 2/Player 3(etc) as necessary.
However when I then alter the code for a new query to combine the attributes from players, I get an incomplete combination.
For instance, let's say my subject data is:
PAttr_ID Player_ID ....PAttr_Desc
-2030941621............. 1262630099...ROY
-474734113................1262630099...MVP(x2)
172521253.................1262630099...400 HRs
472121878.................1262630099...HOF
543792050.................1262630099...1500 RBIs
970477108.................1262630099...3000 Hits
1262789769................1262630099...MVP
I use code:
- SELECT tblPlayerAttributes.Player_ID, Max(Combination([Player_ID],[PAttr_Desc])) AS Attributes
-
FROM tblPlayerAttributes
-
GROUP BY tblPlayerAttributes.Player_ID;
The output is
Player_ID ... Attributes
1262630099...ROY
The same coding that works for Players doesn't work for Attributes. Is that normal? Is there something in the module I'm missing? I've even deleted the query for Players thinking something was retained in values, but nothing works.