ClaraBarton
Registered User.
- Local time
 - Today, 03:09
 
- Joined
 - Oct 14, 2019
 
- Messages
 - 754
 
I created a helper table for some small tables I.e. tblCombo for color, type, group, etc. So then I use Pat Hartman's Address Book. It worked great until I created the helper table.
Using her code to BuildSql I get:
	
	
	
		
This doesn't work because both type and group are from the data column so to get a list box sorted on Type I need:
	
	
	
		
In other words, the query does not work with an alias field. So both Type and Group end up with the same field. How can I fix this?
		
		
	
	
		
	
 Using her code to BuildSql I get:
		Code:
	
	
	SELECT tblCategory.CategoryID, tblCategory.Category,
    tblCombo.Data AS Type,
    tblCombo_1.Data AS [Group],
    tblCategory.Hide, tblCategory.Modified
FROM (tblCategory INNER JOIN tblCombo
    ON tblCategory.fTypeID = tblCombo.CmboID) INNER JOIN tblCombo AS tblCombo_1
    ON tblCategory.fGroupID = tblCombo_1.CmboID 
WHERE Left(Category,1) >= 'A' AND Left(Category,1) <= 'Z'
AND Hide = False ORDER BY Category
	
		Code:
	
	
	SELECT tblCategory.CategoryID, tblCategory.Category,
    tblCombo.Data AS Type,
    tblCombo_1.Data AS [Group],
    tblCategory.Hide, tblCategory.Modified
FROM (tblCategory INNER JOIN tblCombo ON tblCategory.fTypeID = tblCombo.CmboID)
    INNER JOIN tblCombo AS tblCombo_1 ON tblCategory.fGroupID = tblCombo_1.CmboID
WHERE (((tblCombo.Data)>='A' And (tblCombo.Data)<='Z') AND ((tblCategory.[Hide])=False))
ORDER BY tblCategory.Category;