For the tables [tbl_var] ...
variableID variableName
---------- ------------
1 LastName
2 FirstName
3 Sex
... [tbl_db] ...
datasetID datasetName
--------- -----------
1 Demo
2 SomeOther
... and [tbl_vardb] ...
datasetID variableID
--------- ----------
1 3
... if I have a combo box named [cbxDataset] that gets its items from [tbl_db] then I can have another combo box named [cbxVariable] whose Row Source
is
SELECT variableID, variableName
FROM tbl_var
WHERE variableID NOT IN
(
SELECT variableID
FROM tbl_vardb
WHERE datasetID=[cbxDataset]
);
The After Update
event of the [cbxDataset] combo box ensures that the other combo box contains the relevant choices
Private Sub cbxDataset_AfterUpdate()
Me.cbxVariable.Requery
End Sub