Solved

If Null and Dcount

Posted on 2013-06-29
6
411 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye 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 51

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
Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

 

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 51

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

623 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