Solved

If Null and Dcount

Posted on 2013-06-29
6
394 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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