Dcount function - need help with the criteria part! 
Author Message
 Dcount function - need help with the criteria part!

As part of a query, I need to be able to select only part
of a field for a certain record to see if it fits in with
a query (I'm working with a database someone else created,
and the powers that be are used to the layout so they
don't want me to change it).  

So, I found DCount, which seems to do the trick mostly,
except for the fact that using the InStr function (see the
full statement below), rather than something more like one
would find in the where clause of a SQL Select statement,
gives me an "Object Required" message.  

Coll = DCount("Ques1", "SurveyResults", (InStr(1,
SurveyResults.Ques1, "Colleague", 1) <> 0))

Does anyone have an idea on how to get around this?  

Tue, 13 Dec 2005 23:20:32 GMT  
 Dcount function - need help with the criteria part!


>Coll = DCount("Ques1", "SurveyResults", (InStr(1,
>SurveyResults.Ques1, "Colleague", 1) <> 0))

The third argument of DCount should be a text string which evaluates
to a legal SQL WHERE clause without the WHERE: this doesn't.


DCount("Ques1", "SurveyResults", "(InStr(1, SurveyResults.Ques1,
""Colleague"") <> 0)")

I.e. put the whole expression in quotes, and double up the quotes
around Colleague.

                  John W. Vinson[MVP]    
    Come for live chats every Tuesday and Thursday

Wed, 14 Dec 2005 01:02:13 GMT  
 [ 2 post ] 

 Relevant Pages 

1. sql dcount criteria syntax missing operator

2. Help Beginner with DCOUNT function

3. DCOUNT divided by DCOUNT

4. Creating statistical function using DCount

5. Problems with DCount function

6. Dcount / Domain Agg Functions

7. DCount Function

8. Dcount / Domain Agg Functions

9. Need help! data type mismatch in criteria expression

10. Need help querying a table with multiple criteria!

11. Need help with ADO Find when criteria is based on multiple fields

12. Help Needed For Amiga Parts!


Powered by phpBB® Forum Software