Cancel Adding New Record If Condition is True

Actually, I have just discoverred that DCount isn't working with all records. When I debugged, I found out that for some records the Me!PhaseID is Null although the control on the form is displaying a Phase ID. I had that field locked, I unlocked it because I thought that what was causing this issue, but it did not help. Weird that it only works with some of them. Any ideas?
 
Make sure you aren't using lookups at the table level because that could affect it adversely.
 
Unfortunately, I have a few lookups on that table. Why would lookups affect DCount performance? Is there any way around that or probably my original code was better?
 
Last edited:
It's not that they would slow them, it tries to look for the value and because of the way the lookups work (and I mean IN the table, not combos or list boxes on forms but actual lookups stored within the tables), it is not reliable.

http://www.mvps.org/access/lookupfields.htm
 
Cool, I am thinking going back to the old code may be better. Although it may get slower over time, but it should always stop users entering double Plots per Phase. Any suggestions please?
 

Users who are viewing this thread

Back
Top Bottom