PC Review


Reply
Thread Tools Rate Thread

dcount function and nulls, etc.

 
 
=?Utf-8?B?c2FsbW9uZWxsYQ==?=
Guest
Posts: n/a
 
      8th Nov 2006
The following counts all the records in the query called testt where the
“supervisor” field has “rampersad” and the “approved field” is “yes”.

x = DCount("[supervisor]", "testt", "[supervisor] = 'rampersad'" & "And" &
"[approved] = 'yes'")

Question, how can I change this so that the” approved” field = “null” or
“not null” or “not like ‘ a particular value’”?


Thanks,

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmFycnkgR2lsYmVydA==?=
Guest
Posts: n/a
 
      8th Nov 2006
The domain aggregate functions (DCount, DLookup, etc.) use standard sql where
syntax for their criteria clauses. To check for a null value, use something
like:
x = DCount("[supervisor]", "testt", "[supervisor] = 'rampersad'" & " And
[approved] Is Null")
or
x = DCount("[supervisor]", "testt", "[supervisor] = 'rampersad'" & " And
[approved] Is Not Null")

If you need help creating these criteria clauses, you can make a temporary
query, fill in the criteria, and look at the resulting sql.

Barry

"salmonella" wrote:

> The following counts all the records in the query called testt where the
> “supervisor” field has “rampersad” and the “approved field” is “yes”.
>
> x = DCount("[supervisor]", "testt", "[supervisor] = 'rampersad'" & "And" &
> "[approved] = 'yes'")
>
> Question, how can I change this so that the” approved” field = “null” or
> “not null” or “not like ‘ a particular value’”?
>
>
> Thanks,
>

 
Reply With Quote
 
=?Utf-8?B?c2FsbW9uZWxsYQ==?=
Guest
Posts: n/a
 
      9th Nov 2006
Thanks Barry!!



"Barry Gilbert" wrote:

> The domain aggregate functions (DCount, DLookup, etc.) use standard sql where
> syntax for their criteria clauses. To check for a null value, use something
> like:
> x = DCount("[supervisor]", "testt", "[supervisor] = 'rampersad'" & " And
> [approved] Is Null")
> or
> x = DCount("[supervisor]", "testt", "[supervisor] = 'rampersad'" & " And
> [approved] Is Not Null")
>
> If you need help creating these criteria clauses, you can make a temporary
> query, fill in the criteria, and look at the resulting sql.
>
> Barry
>
> "salmonella" wrote:
>
> > The following counts all the records in the query called testt where the
> > “supervisor” field has “rampersad” and the “approved field” is “yes”.
> >
> > x = DCount("[supervisor]", "testt", "[supervisor] = 'rampersad'" & "And" &
> > "[approved] = 'yes'")
> >
> > Question, how can I change this so that the” approved” field = “null” or
> > “not null” or “not like ‘ a particular value’”?
> >
> >
> > Thanks,
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DCount Nulls patientgrow Microsoft Access 4 6th Aug 2008 08:16 PM
NZ function & Nulls Gaetanm via AccessMonster.com Microsoft Access Form Coding 5 6th Jun 2007 05:29 PM
Using dcount function within user-defined worksheet function =?Utf-8?B?cG9uZ3RoYWk=?= Microsoft Excel Programming 3 15th Jan 2007 09:55 AM
Compact function creates Nulls Stephen Haley Microsoft Access 8 19th Dec 2005 04:40 PM
IIf Function and nulls Michael Microsoft ADO .NET 2 5th Jan 2004 05:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:14 AM.