i need to create a lookup table in Access, where all the abbreviations are related to a value, and if the abbreviation (in the main table) is null, then i want to show “Unknown”
i got the values working, but i can’t seem to get the nulls to show up.
my lookup table looks like this:
REQUEST REQUEST_TEXT
------------------------
A Approve
D Disapprove
NULL N/A
but when i do a count by request, it only shows me values for A and D, all though i know there are some blanks in there as well.
what am i doing wrong?
This should be easier if you change tblLookup.
Then, in tblMain, change the REQUEST field to Required = True and Default Value = “U”. When new records are added, they will have U for REQUEST unless the user changes it to A or D.
Then a query which JOINs the 2 tables on REQUEST should get you what I think you want.
You should also create a relationship between the 2 tables, and select the option to enforce referential integrity in order to prevent the users from adding a spurious value such as “X” for REQUEST.
Edit:
If changing tblMain structure is off the table, and if you’re doing this from within an Access session, you can use the Nz() function on a LEFT JOIN.
If you’re doing this from outside an Access session, like from ASP, the Nz() function will not be available. So you can substitute an IIf() expression for Nz().
Edit2: You can’t directly JOIN with Null values. However with the “Unknown” row I suggested for tblLookup, you could use a JOIN which includes Nz for tblMain.REQUEST
If you want to leave tblLookup REQUEST as Null for REQUEST_TEXT = Unknown, I suppose you could use Nz on both sides of the JOIN expression. However, this whole idea of joining Nulls makes me cringe. I would fix the tables instead.