jmentor,
WB!
Some friendly words of advice: you might save yourself some trouble in the future by not focusing so narrowly on a particular means to accomplish an end. I d/led and looked at your database. Ultimately, you want a report to display data based on a user-selected criterion or lackthereof. If you had framed your question with this in mind, you might have gotten different, if not better, advice.
Anyway, I?ll help you to fix what you?ve already done so that it will work the way that you want it. Then, I?ll give you some sample code and talk about Jadedata?s recommendation, which is the approach?I think?that more seasoned Access users would take, because it?s more versatile.
Okay, first, what you?ve made works fine except when a user selects All Types. The data in the bound column for All Types is ALL, but there are no records in tblClients with ALL for ClientType; therefore, the subform will never display data when a user chooses All Types. This is no good, obviously, since you want your users to see the type of data that will go into the report.
To fix it you need to do two things. First, you need to change the SQL statement of your combo box. Instead of ALL, which will return no records, you should use the wildcard character for Access, which is an asterisk. Below is what you want:
SELECT ClientType, ClientTypeDescription FROM tblClientTypes UNION SELECT '*' as ClientType, 'All Types' as ClientTypeDescription FROM tblClientTypes
ORDER BY ClientTypeDescription;
Second, you need to change the SQL of your query so that it?ll return all records whenever a user selects All Types. Below is what you want:
SELECT tblClients.ClientCode, tblClients.ClientName, tblClientTypes.ClientType, tblClientTypes.ClientTypeDescription
FROM tblClientTypes INNER JOIN tblClients ON tblClientTypes.ClientType = tblClients.ClientType
WHERE (((tblClientTypes.ClientType) Like [forms]![frmClientsByType]![ClientType]))
ORDER BY tblClients.ClientName;
If you want to filter out blanks, then you should use this instead...
SELECT tblClients.ClientCode, tblClients.ClientName, tblClientTypes.ClientType, tblClientTypes.ClientTypeDescription, tblClientTypes.ClientType
FROM tblClientTypes INNER JOIN tblClients ON tblClientTypes.ClientType = tblClients.ClientType
WHERE (((tblClientTypes.ClientType) Like [forms]![frmClientsByType]![ClientType]) AND ((tblClientTypes.ClientType) Is Not Null))
ORDER BY tblClients.ClientName;
These changes mean that when a user selects All Types, the criterion will be ClientType LIKE '*', which returns all records. If you execute the query or the report based on the query, you?ll see that both display all records. Unfortunately, this isn?t the case when it comes to the subform. It will not show any data. The reason for this is because when you use Master/Child fields, Access looks for a literal match. In other words, Access will only display records on the subform where ClientType = '*'. In this case, Access doesn?t treat the asterisk as a wildcard; instead, it literally looks for records with an asterisk in the ClientType field. Obviously, that?s not what you want.
[I?ll finish this post later.]