Solved

If Null and Dcount

Posted on 2013-06-29
6
397 Views
Last Modified: 2013-07-05
In the below, if Dcount is >0  then the return will either be "Yes" or "-".  I want to add a criteria if Dcount is Null then return " " (a blank) to show me that there are no records.  I think I need to add another criteria?  Possibly Switch?  

ExpctDepart: IIf(DCount("*","qryDepartures_3","ProjectID= " & [Projects.ID])>0,"Yes","-")

qryDepartures_3:
SELECT tblDepartures.ProjectID, tblDepartures.DraftedDocYN, tblDepartures.ConfirmedDepartureYN
FROM tblDepartures
WHERE (((tblDepartures.ConfirmedDepartureYN) Is Null Or (tblDepartures.ConfirmedDepartureYN)=True))
GROUP BY tblDepartures.ProjectID, tblDepartures.DraftedDocYN, tblDepartures.ConfirmedDepartureYN
HAVING (((tblDepartures.DraftedDocYN)="Yes" Or (tblDepartures.DraftedDocYN) Is Null));


thank you
0
Comment
Question by:pdvsa
  • 3
  • 2
6 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 total points
ID: 39286724
DCOUNT will never be NULL.  It will always return a numeric value.
0
 

Author Comment

by:pdvsa
ID: 39286731
Hi fyed, maybe i could use =0 somehow?
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 39286741
You probably think of something like this:

ExpctDepart: Format(DSum("Abs([DraftedDocYN])","qryDepartures_3","ProjectID= " & [Projects.ID]), "\Y\e\s;;\-;")

/gustav
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

Author Comment

by:pdvsa
ID: 39286779
Cactus.... Very funky looking.... Interesting.  I will test when back at computer.  Thank you
0
 

Author Comment

by:pdvsa
ID: 39286901
Cactus,

I get a "data type mismatch in criteria or expression" error when I run from qry design builder.  When I paste it, it changes it a bit to the below.  

ExpctDepart: Format(DSum("Abs([DraftedDocYN])","qryDepartures_3","ProjectID= " & [Projects.ID]),"""Yes"";;-")
                      ^^^^^^^^

Not sure if DraftedDocYN would be the problem.  It is not a true YN field...I have since then modified it to a combo value list with values of "Yes";"No";"previously issued";"Don’t Need it"

let me know what is next...
0
 
LVL 49

Assisted Solution

by:Gustav Brock
Gustav Brock earned 250 total points
ID: 39287161
If DraftedDocYN is not a Boolean field (WHO could know), you will, of course, have to adjust.

Try starting with a Boolean field and:

ExpctDepart: DSum("Abs([DraftedDocYN])","qryDepartures_3","ProjectID= " & [Projects.ID] & "")

The apply the format.

/gustav
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question