For your Admin people, you will need to provide a different form
that does not apply this criteria. Alternatively, you could use
VBA code to conditionally include such records in the recordset,
but that's getting more advanced than I suspect you are willing to
deal with.
It's pretty simple. All you'd need to do is have a function that
checks if someone is a member of the administrative group, and if
so, return *, and if not, return True. Then put that as the
criterion in your recordsource for the APPROVED field.
That function would be most efficient it if used a Static variable,
something like this:
Public Function IsAdmin() As Variant
Static strCurrentUser as String
Static bolIsAdmin As Boolean
If Len(strCurrentUser) = 0 Then
strCurrentUser = CurrentUser()
bolIsAdmin = IsGroupMember(strCurrentUser, "Admin")
End If
IsAdmin = bolIsAdmin
End Function
Public Function IsGroupMember(strUser As String, _
strGroup As String) As Boolean
Dim varGroup As Variant
Dim bolIsGroupMember As Boolean
For Each varGroup in DBEngine(0).Users(strUser).Groups
If varGroup.Name = strGroup Then
bolIsGroupMember = True
Exit For
End If
Next varGroup
Set varGroup = Nothing
IsGroupMember = bolIsGroupMember
End Function
You'd perhaps want to add error handling for the case where you pass
a user name that's invalid, but if you're getting it from
CurrentUser(), it can never go wrong.
Of course, if you're not using Jet user-level security, none of this
will work. You could use the Windows logon, but then you need some
group authority, and I haven't as yet figured out how to use Active
Directory in Access to be able to get that kind of information. It's
easy to get security groups, but not so easy to get AD
Organizational Units, which often tell you more than the security
groups (for instance, in an organization with multiple sites,
everyone will be in the Users group, but each person will likely be
in a particular Organizational Unit -- you likely would want to know
the OU more often than the group).
If anyone has VBA code for getting OU's from AD, I'd be thrilled to
see it. The examples on MSDN just confuse the hell out of me.