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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering based on contents of unrelated table

Status
Not open for further replies.

herbivorous

Technical User
Mar 28, 2002
32
0
0
US
I am building an app that tracks, among other things, contacts with members of the table People. I am working on a master filtering page, and want to be able to slap on a filter so that only those with a certain contact code come up.

My first attempt has been to build a DLookup into the SQL statement, but so far it has failed:

(DCount('[Contact ID]','table![Contact Log]','ID = " & Chr(34) & " & ID & " & Chr(34) & " And [Contact Code] = " & Chr(39) & Me!CCode & Chr(39) & ") > 0 )"

Gives me an SQL statement like

(DCount('[Contact ID]','table![Contact Log]','ID = " & ID & " And [Contact Code] = 'Book Tour') > 0 )

Generating the following complaint: Syntax error (missing operator)

I could potentially approach it differently -- using a loop through the Contact Log table to generate list of IDs for an ID IN (1,4,9,23) statement.

Or perhaps there is another option. I don't want to relate the table, which would be the easiest way to handle this, I guess. But there are reasons against that I don't know how to surmount.

Thanks!
 
OK, I see the missing quotes there near the end, but I end up baffled as to how to handle what would be, I think, a third level of nested quotes around Book Tour. So help is still needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top