lrAsIgo said:
When I use your code I get an error... expected list seperator or )
debugger highlights [ComputerData] part.
If Dcount ("[DataPanel],"[ComputerData]","[DataPanel] = '" & Me.cmbDataPanel & _
"' AND [DataPanel] = " & Me.DataPanel Then
MsgBox "You cannot duplicate this selection. Please choose another."
Cancel = True
any ideas?
Yep - you missed a closing quote on the [DataPanel] part.
I'm not sure I understand what you're trying to do, so let me restate it as I see it.
You have a table, Table4, which is your 'main' table. It has a PK field, as any good table should, which happens to be Text. Then you have Table1, table2, and Table3, each of which relates to table4 by way of the PK, which is now a FK in their table. So far so good..
So what you're trying to do is make sure that any one FK entry is not duplicated in any one of those three tables? Your Dcount has both the combo cmbDataPanel, presumably looking up in Table4 for its values, and a text field DataPanel. How does the latter differ from the former, please?
As I've described it it sounds like a One-to-One relationship between Table4 and each of the other three tables. Which is rather unusual, and makes me think I've missed something.
Perhaps we can back up and, without using forms and controls, explain what you're trying to do. What do your four tables represent, briefly? What links them?