Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

execute code if results or recordset search are false

Status
Not open for further replies.
Oct 6, 2002
60
US
Good day all,

I am not very good with recordsets so I need some help on this one. I have a table - tblWarning (fields: WarnID, WarnType, EmpID, WarnDone.) that stores info. on employee warnings about attendance issues. I need to loop through the table (I think I have to use a recordset) and display a message if: the EmpID matches the active forms' EmpID, the warning type matches certain criteria, and if the warnDone (a checkbox) is false. Any help on how to set this code up would be greatly appreciated.

Thanks in advance,
Boomer
 
Actually, you might not need a recordset at all here. It seems to me you could use the following to determine whether any records exist that meet your criteria:
Code:
    If DCount("*", "tblWarning", _
        "EmpID = '" & Me![EmpID] & "' " _
        & "AND WarnType IN ('A', 'B', ...) " _
        & "AND WarnDone = False") > 0 Then
        MsgBox "Warning!"
    End If
Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top