If (DCount("*", "TCheckNo", "EmployeeID=" & Me.EmployeeID & "ChkPD Is Null") > 0) Or (DCount("*", "tblMiscChecks", "EmplID=" & Me.EmployeeID & "mPaid Is Null") > 0) Then 'Can't change employee type if unpaid checks.
RESOLVED:
Thanks,
Last edited by burrina on 10 Feb 2017, 17:34, edited 1 time in total.
You need an operator between the two conditions, I assume AND:
If (DCount("*", "TCheckNo", "EmployeeID=" & Me.EmployeeID & " AND ChkPD Is Null") > 0) Or (DCount("*", "tblMiscChecks", "EmplID=" & Me.EmployeeID & " AND mPaid Is Null") > 0) Then
Thanks. But for some reason I am not getting the result I expect. I can still change/edit the record. If the code runs successfully? Then
Me.EmpOrCon.Enabled = False
I should not be able to change this, but I can?
tblEmployees is not linked to TCheckNo except by Master/Child on other form with a subform is why!
This code is run on frmEmployees and there is no link between tblEmployee EmployeeID and TCheckNo EmpID that equals the same EmployeeID in tblMiscChecks
Example:
tblMiscChecks EmpID FK 15
TCheckNo EmployeeID FK 8
tblEmployees EmployeeID PK 8
Last edited by burrina on 09 Feb 2017, 16:06, edited 1 time in total.
Yes, it is. tblMiscChecks and tblEmployees are OK. TCheckNo and tblEmployees are NOT. They are linked by Master/Child ONLY via Form/Subform on another form.
If DCount("*", "TCheckNo", "EmployeeID=" & [frmMiscellaneousChecks].[Form]!EmpID & " AND ChkPD Is Null") Or (DCount("*", "tblMiscChecks", "EmpID=" & Me.EmployeeID & " AND mPaid Is Null") > 0) Then