I have a form called "Labor Tracker" whose data source is a table called "Labor". In this form, the user enters information for three fields called
1. IITR (integer)
2. WorkOrderNo (text)
In the before update event of this form, I would like a table called "iitdata" to be opened, where vba checks the "IITReportNo" field (integer) and checks for a matching IITR value AND checks the "ReceiverNo" field (text) and checks for a matching WorkOrderNo. If neither matches are found, an error message stating that the IITR and/or WorkOrderNo are incorrect. So IITR should map to IITReportNo and WorkOrderNo maps to ReceiverNo.
I only got so far as to open the iitdata table as a recordset but am not sure how to now perform the check. I could really use expert help please. Thanks.
Dim db As DAO.Database
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo ProcErr
Dim rst As DAO.Recordset
Dim rstcount As Integer
Dim TableName As String
TableName = "iitdata"
Set db = CurrentDb
Set rst = db.OpenRecordset(TableName)