HRN_SciTech
Registered User.
- Local time
- Today, 05:17
- Joined
- Jun 26, 2013
- Messages
- 26
Hi there,
I have a database in which I am building up an inventory of all the chemicals in our laboratory. There is a table in which all the data is stored (Chemical), a query (ChemQuery) and a form for searching (ChemSearch). There is also one more form for data entry (ChemicalEntry) but that's irrelevant I think.
Anyway, the problem is that chemicals that are missing information are not showing up in the query. I need these to show up. In ChemicalEntry, you can search for Chemical, Synonyms & Category.
Currently, if you run a search it does not return any chemicals which are missing the synonym (not applicable for some) and the category (left blank deliberately for some).
The SQL code currently reads:
SELECT Chemicals.Chemical, Chemicals.Synonyms, Chemicals.Category, Chemicals.Location, Chemicals.[Amount present (g/mL)], Chemicals.[CAS number], Chemicals.Classification, Chemicals.Class, Chemicals.[Shelf Life], Chemicals.[Expiry Date]
FROM Chemicals
WHERE (((Chemicals.Chemical) Like "*" & [Forms]![ChemSearch]![Chemical] & "*") AND ((Chemicals.Synonyms) Like "*" & [Forms]![ChemSearch]![Synonyms] & "*") AND ((Chemicals.Category) Like "*" & [Forms]![ChemSearch]![Chemical] & "*"));
I noticed on another thread someone had the same problem and they used "Like IFF(IsNull" but I can't get this code to work for the 'Category' field, though it was working for the 'Synonym' field.
Help??
Thank you!
I have a database in which I am building up an inventory of all the chemicals in our laboratory. There is a table in which all the data is stored (Chemical), a query (ChemQuery) and a form for searching (ChemSearch). There is also one more form for data entry (ChemicalEntry) but that's irrelevant I think.
Anyway, the problem is that chemicals that are missing information are not showing up in the query. I need these to show up. In ChemicalEntry, you can search for Chemical, Synonyms & Category.
Currently, if you run a search it does not return any chemicals which are missing the synonym (not applicable for some) and the category (left blank deliberately for some).
The SQL code currently reads:
SELECT Chemicals.Chemical, Chemicals.Synonyms, Chemicals.Category, Chemicals.Location, Chemicals.[Amount present (g/mL)], Chemicals.[CAS number], Chemicals.Classification, Chemicals.Class, Chemicals.[Shelf Life], Chemicals.[Expiry Date]
FROM Chemicals
WHERE (((Chemicals.Chemical) Like "*" & [Forms]![ChemSearch]![Chemical] & "*") AND ((Chemicals.Synonyms) Like "*" & [Forms]![ChemSearch]![Synonyms] & "*") AND ((Chemicals.Category) Like "*" & [Forms]![ChemSearch]![Chemical] & "*"));
I noticed on another thread someone had the same problem and they used "Like IFF(IsNull" but I can't get this code to work for the 'Category' field, though it was working for the 'Synonym' field.
Help??
Thank you!
