Query help - Postet den (1665 Views)
Average Member
Jorrit787
Innlegg: 681
681
I have a table in my Access DB that contains a field with lists of comma-delimited usergroup IDs. How can I select only those records in which the usergroup ID of the current user does not appear in the list of usergroup IDs in the database?
Something like this doesn't work:

SELECT * FROM TABLE WHERE " & m_usergroup & " NOT IN exclude_usergroups"

m_usergroup in this case could be "4", and a particular record could have an exclude_usergroups field value of "1,2,5,6".
   
 Sidestørrelse 
Postet den
Snitz Forums Admin
ruirib
Innlegg: 26364
26364
What is the table that has the usergroups to be exclused?
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
you need to do

SELECT * FROM TABLE WHERE '" & m_usergroup & "' NOT IN exclude_usergroups"
Postet den
Average Member
Jorrit787
Innlegg: 681
681
So, late response, but better late than never, right?
I tried your suggestion Huw, but I get this error:

Code:
Microsoft JET Database Engine error '80040e14'

In operator without () in query expression 'sectionid=103 AND '0' NOT IN usergroup'.
Postet den
Forum Admin
HuwR
Innlegg: 20611
20611
try
SELECT * FROM TABLE WHERE '" & m_usergroup & "' NOT IN (exclude_usergroups)"
 
Du må legge inn en melding