smalloy
Posts: 107
|
| Posted: 06/06/2005, 8:34 AM |
|
The object is to test the database for employee_no with a same Period ID. If you find one add a error to stop the Insert (or Update) and notify the user. Here is what I propose:
Dim intEmp_no
Dim intPeriod_id
Dom intMatch
intEmp_no = Record_or_Grid.textBoxName.Value
intPeriod_id = Record_or_Grid.textBoxName.Value
'Test for the employee in the same period
intMatch = CCDLookUp("employee_no", "tableName", "employee_no = " & intEmp_no & " AND period_id = " & intPeriod_id, dbDataConnection)
If Len(intMatch) > 0 Then ' there is one, add the error
Record_or_Grid.Errors.AddError "You may not add an employee twice in the same payperiod."
End If
I hope this helps!
_________________
Anything can be done, just give me time and money. |