Hi everyone, hope someone will be able to help me! I'm developing this database in Access, but I think the problem's primarily an SQL one.
I have the following table structure in place -
Quote:
tblContact
ContactID (Autonumber, P.K.)
Name (Text)
tblContactBenchMarkLink
ID (Autonumber, P.K.)
ContactID (Number, one to many from tblContact)
BenchmarkID (Number, One to many from tblBenchmark)
tblBenchmark
ID (P.K., autonumber)
Benchmark (text)
And I also have a combo box on a subform that uses the following recordsource to do its magic:
Quote:
SELECT [tblBenchmark].[BenchmarkID], [tblBenchmark].[Benchmark] FROM tblBenchmark;
Now, the data from tblBenchmark, benchmarkID and Benchmark should only be linked to a contactID (via tblContactBenchMarkLink) ONCE.
What I want to do is use some code, perhaps via the form_current event, to requery the combo box to NOT include benchmarks that already have a record in tblContactBenchMarkLink for the current contact.
For example, if there are:
4 benchmarks - power (BenchMarkID=1), top_speed (2), standard_equipment (3) and fuel_economy (4)
2 contacts - Bob (ContactID=1) & Sam (2)
and tblContactBenchMarkLink contains two records -
ID 1, ContactID 2, BenchmarkID 2
ID2, ContactID 2, BenchmarkID 3
The next time I select Sam's record, and click on the combo box that allows me to select his benchmarks in a new record in tblContactBenchMarkLink, I want only power and fuel_economy to appear, since I've already told the db that Sam cares about top_speed and standard_equipment.
Does anyone know if this is possible, and if so, how to go about it? I think it's probably just a case of updating the recordsource property of the combo when the form's current, but I'm not sure how to write this sql string.
- Here's the thing I need to do then - select BenchMarkID and Benchmark fields from tblBenchmark when the records corresponding to a particular contact in tblContactBenchmarkLink do NOT contain the BenchmarkID
Here's hoping someone knows of a solution!
Thx in advance,
Aljrob