dcount function and nulls, etc.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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,
 
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
 
Thanks Barry!!



Barry Gilbert said:
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 said:
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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top