parameter query and DCount

uday

Registered User.
Local time
Today, 19:27
Joined
Nov 12, 2001
Messages
13
Hi all!
I have a query which has a function as its parameter. The function is in a module and is a public function. All it does is returns the value of a global variable to the query. Here is my query....

SELECT C.CONTACT_ID, CL.LOCATION_ID, L.SITE_ID FROM CONTACTS AS C, CONTACT_LOCATION AS CL, LOCATIONS AS L
WHERE (((C.CONTACT_ID)=[CL].[CONTACT_ID]) AND ((CL.LOCATION_ID)=[L].[LOCATION_ID]) AND ((L.SITE_ID)=getsiteval()));

Then on one of my forms I have a need to utilize the DCOUNT function, so here's what I do next..
contactcount = DCount("[contact_id]", "qryContactCount", "[site_id] = " & SITEIDGLOBAL & "")

For some reason, either my query cannot execute or the DCOUNT is failing. Can someone help please
regards
Uday
 
If your SiteID is numerical try this:

DCount("[contact_id]", "qryContactCount", "[site_id] = " & SITEIDGLOBAL)

If it is text try this:

DCount("[contact_id]", "qryContactCount", "[site_id] = '" & SITEIDGLOBAL & "'")

[This message has been edited by Jack Cowley (edited 11-12-2001).]
 
Thankx Jack, it turned out that I had not declared my function as "public". It works now! And thankx for the tip on passing a numeric parameter....

regards
uday
 
Thankx Pat, actually thats where the problem was. The query was'nt working outside the DCOUNT....
I love this forum....its great
rgds
Uday
 

Users who are viewing this thread

Back
Top Bottom