Working with MS Access for the first time and coming across a few problems if someone could please point me in the right direction.
So I’m doing a mock database (so it looks silly) just to learn the ins and outs and need some help with DLookUp at the moment.
My database has two tables, with the following fields:
C_ID the PK in Courses and FK in Student
tblCourse: C_ID, Title, Subject
tblStudent: S_ID, C_ID, Name, EnrollDATE
As I said this is just for testing/learning. So what I want is to have a filter that gives me a list of C_ID‘s based on which EnrollDates are NULL.
so filter is:
Expr1: DLookUp("[tblStudent]![C_ID]","tblStudent","isNull([tblStudent]![EnrollDATE])")
I have also tried with the criteria being
[tblStudent]![EnrollDATE] = Null
Currently I get just blank fields returned. Any help is greatly appreciated, and please ask me to elaborate if my explanation is off.
Thank You!
The correct syntax looks like this:
Nullby usingxxx is nullorxxx is not nullNote that
DLookuponly returns one value (if the criteria matches more than one row, the value is taken from any row), so you can’t use it to get a list ofC_IDs back.EDIT:
What you actually want to do is select data from one table, and filter that based on data from the other table, correct?
Like, selecting all courses where at least one student has an empty
EnrollDATE?If yes, you don’t need the
DLookupat all, there are two different ways how to do that:1) With a sub-select:
2) By joining the tables:
This is SQL, so you need to switch to SQL View in your query in Access.