J
johnlute
Access 2003.
I wasn't sure where to post this because it involves a form and query.
This seemed more the appropriate forum.
I have a form [Main Menu] which has two controls [cbAllergen] and
[cbSensitivity]. I use these controls to filter a report which has
this record source:
SELECT IngredientMaster.IMNumber, IngredientMaster.IMDescription,
qryINGsAllergens.Allergens, qryINGsSensitivities.Sensitivities
FROM (IngredientMaster LEFT JOIN qryINGsAllergens ON
IngredientMaster.IMNumber = qryINGsAllergens.IMNumber) LEFT JOIN
qryINGsSensitivities ON IngredientMaster.IMNumber =
qryINGsSensitivities.IMNumber
WHERE (((qryINGsAllergens.Allergens) Like [Forms]![Main Menu]!
[cbAllergen] & "*") AND ((qryINGsSensitivities.Sensitivities) Like
[Forms]![Main Menu]![cbSensitivity] & "*")) OR
(((qryINGsSensitivities.Sensitivities) Like [Forms]![Main Menu]!
[cbSensitivity] & "*") AND (([Forms]![Main Menu]![cbAllergen]) Is
Null)) OR (((qryINGsAllergens.Allergens) Like [Forms]![Main Menu]!
[cbAllergen] & "*") AND (([Forms]![Main Menu]![cbSensitivity]) Is
Null)) OR ((([Forms]![Main Menu]![cbAllergen]) Is Null) AND (([Forms]!
[Main Menu]![cbSensitivity]) Is Null));
The two queries [qryINGsAllergens] and [qryINGsSensitivities]
concatenate lke this:
SELECT IngredientMaster.IMNumber, Concatenate("SELECT INGsAllergens
FROM tblINGsAllergens WHERE IMNumber =" & [IMNumber] & " ORDER BY
INGsAllergens") AS Allergens
FROM IngredientMaster
WHERE (((IngredientMaster.IMNumber) In (SELECT IMNumber FROM
tblINGsAllergens)));
Let's say that [IMNumber] 1 has this concatenated allergen value:
"Egg, Fish, Milk"
Here's the progblem: If I select "Milk" in [Main Menu].[cbAllergen]
then the report returns Null. Clearly, because Access is looking
strictly for the first value in the concatenation. If I select "Egg"
in [Main Menu].[cbAllergen] then the report returns "Egg, Fish, Milk"
as desired.
How can I re-configure this to resolve the problem?
Thanks for your time!
I wasn't sure where to post this because it involves a form and query.
This seemed more the appropriate forum.
I have a form [Main Menu] which has two controls [cbAllergen] and
[cbSensitivity]. I use these controls to filter a report which has
this record source:
SELECT IngredientMaster.IMNumber, IngredientMaster.IMDescription,
qryINGsAllergens.Allergens, qryINGsSensitivities.Sensitivities
FROM (IngredientMaster LEFT JOIN qryINGsAllergens ON
IngredientMaster.IMNumber = qryINGsAllergens.IMNumber) LEFT JOIN
qryINGsSensitivities ON IngredientMaster.IMNumber =
qryINGsSensitivities.IMNumber
WHERE (((qryINGsAllergens.Allergens) Like [Forms]![Main Menu]!
[cbAllergen] & "*") AND ((qryINGsSensitivities.Sensitivities) Like
[Forms]![Main Menu]![cbSensitivity] & "*")) OR
(((qryINGsSensitivities.Sensitivities) Like [Forms]![Main Menu]!
[cbSensitivity] & "*") AND (([Forms]![Main Menu]![cbAllergen]) Is
Null)) OR (((qryINGsAllergens.Allergens) Like [Forms]![Main Menu]!
[cbAllergen] & "*") AND (([Forms]![Main Menu]![cbSensitivity]) Is
Null)) OR ((([Forms]![Main Menu]![cbAllergen]) Is Null) AND (([Forms]!
[Main Menu]![cbSensitivity]) Is Null));
The two queries [qryINGsAllergens] and [qryINGsSensitivities]
concatenate lke this:
SELECT IngredientMaster.IMNumber, Concatenate("SELECT INGsAllergens
FROM tblINGsAllergens WHERE IMNumber =" & [IMNumber] & " ORDER BY
INGsAllergens") AS Allergens
FROM IngredientMaster
WHERE (((IngredientMaster.IMNumber) In (SELECT IMNumber FROM
tblINGsAllergens)));
Let's say that [IMNumber] 1 has this concatenated allergen value:
"Egg, Fish, Milk"
Here's the progblem: If I select "Milk" in [Main Menu].[cbAllergen]
then the report returns Null. Clearly, because Access is looking
strictly for the first value in the concatenation. If I select "Egg"
in [Main Menu].[cbAllergen] then the report returns "Egg, Fish, Milk"
as desired.
How can I re-configure this to resolve the problem?
Thanks for your time!