How about
:
Not IsNull(DLookup("GroupID", "tblGroupMembership", _
"(GroupID = " & lngGroupID & ") AND (EntityID = " & lngEntityID & ")"))
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Access" <alderran666@gmail.com> wrote in message
news:1137934094.701751.313460@f14g2000cwb.googlegr oups.com...[color=blue]
>I am looking for the most efficient method to check for a entity
> membership in a group. Is there a better method than this? I am
> working with a native Access database. At some point I'll probably end
> up splitting the data from the front end.
>
> Public Function isGroupMember(lngEntityID As Long, lngGroupID As Long)
> As Boolean
> On Error GoTo err_isGroupMember
> Dim rs As New ADODB.Recordset
> Dim strSQL As String
>
> strSQL = "SELECT tblGroupMembership.GroupID,
> tblGroupMembership.EntityID FROM tblGroupMembership WHERE
> (((tblGroupMembership.GroupID)=" & lngGroupID & ") AND
> ((tblGroupMembership.EntityID)=" & lngEntityID & "));"
> rs.Open strSQL, CurrentProject.Connection, adOpenForwardOnly,
> adLockReadOnly
>
> If rs.EOF Then
> isGroupMember = False
> Else
> isGroupMember = True
> End If
> rs.Close
> Set rs = Nothing
>
> err_isGroupMember:
> If Err <> 0 Then
> isGroupMember = False
> End If
> End Function[/color]