I have created a database to track employee time. Within that, I have
also created a report off the following query:
SELECT ALLTasksFilter.ProjectName,
Sum([qryDateFilterTaskHours-Daily].NumberOfCompletions) AS
SumOfNumberOfCompletions,
Sum([qryDateFilterTaskHours-Daily].HoursWorked) AS SumOfHoursWorked,
[qryDateFilterTaskHours-Daily].WorkedByWho
FROM ALLTasksFilter LEFT JOIN [qryDateFilterTaskHours-Daily] ON
ALLTasksFilter.ProjectName = [qryDateFilterTaskHours-Daily].ProjectName
GROUP BY ALLTasksFilter.ProjectName,
[qryDateFilterTaskHours-Daily].WorkedByWho;
The Report displays the Task Name, how many completions, and how many
hours.
The report shows ALL tasks, even those that do not have any completions
or hours attributed. Right now, the report shows a blank if there is
no reported completions or time. Is there any way to make it show a
"0" if not time has been documented?
The Pseudocode of:
If [Number of Completions] is null,
Then Me.Number of Completions = "0"
Else
If [HoursWorked] is null,
Then Me.Number of Completions = "0"
Else
Any suggestions would be greatly appreciated! 7 20666
"Drum2001" <dr******@gmail.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com... I have created a database to track employee time. Within that, I have also created a report off the following query:
SELECT ALLTasksFilter.ProjectName, Sum([qryDateFilterTaskHours-Daily].NumberOfCompletions) AS SumOfNumberOfCompletions, Sum([qryDateFilterTaskHours-Daily].HoursWorked) AS SumOfHoursWorked, [qryDateFilterTaskHours-Daily].WorkedByWho FROM ALLTasksFilter LEFT JOIN [qryDateFilterTaskHours-Daily] ON ALLTasksFilter.ProjectName = [qryDateFilterTaskHours-Daily].ProjectName GROUP BY ALLTasksFilter.ProjectName, [qryDateFilterTaskHours-Daily].WorkedByWho;
The Report displays the Task Name, how many completions, and how many hours.
The report shows ALL tasks, even those that do not have any completions or hours attributed. Right now, the report shows a blank if there is no reported completions or time. Is there any way to make it show a "0" if not time has been documented?
The Pseudocode of:
If [Number of Completions] is null, Then Me.Number of Completions = "0"
Else
If [HoursWorked] is null, Then Me.Number of Completions = "0"
Else
Any suggestions would be greatly appreciated!
If [Number of Completions] is null, Then
Me.Number of Completions = NZ([Number of Completions],0)
Else
Me.Number of Completions = NZ([HoursWorked],0)
End If
Ron,
Where would I put this? The Report? The Query?
"Drum2001" <dr******@gmail.com> wrote in message
news:11*********************@e56g2000cwe.googlegro ups.com... Ron,
Where would I put this? The Report? The Query?
1.In On Format event of the report
If isnull(me![Number of Completions])l, Then
Me![Number of Completions] = NZ(Me![Number of Completions],0)
Else
Me![Number of Completions] = NZ(me![HoursWorked],0)
End If
2. In the Control source property of the field in the report
= NZ([Number of Completions],NZ([HoursWorked],0))
3. As a calculated field in the query
NZ([Number of Completions],NZ([HoursWorked],0)) As NumberofCompletions
None of those worked for me.
#1 Kept Errored Out
#2 Displayed all the resultes as ERROR#
#3 Getting "Wrong Syntax" error
Any ideas why?
paii, Ron wrote: "Drum2001" <dr******@gmail.com> wrote in message news:11*********************@e56g2000cwe.googlegro ups.com... Ron,
Where would I put this? The Report? The Query?
1.In On Format event of the report
If isnull(me![Number of Completions])l, Then
Me![Number of Completions] = NZ(Me![Number of Completions],0)
Else
Me![Number of Completions] = NZ(me![HoursWorked],0)
End If
2. In the Control source property of the field in the report
= NZ([Number of Completions],NZ([HoursWorked],0))
3. As a calculated field in the query
NZ([Number of Completions],NZ([HoursWorked],0)) As NumberofCompletions
"Drum2001" <dr******@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com... None of those worked for me.
#1 Kept Errored Out #2 Displayed all the resultes as ERROR# #3 Getting "Wrong Syntax" error
Any ideas why?
Can you give me examples of the code you entered?
Change your query as follows:
SELECT ALLTasksFilter.ProjectName,
Sum(Nz([qryDateFilterTaskHours-Daily].NumberOfCompletions,0)) AS
SumOfNumberOfCompletions,
Sum(Nz([qryDateFilterTaskHours-Daily].HoursWorked,0)) AS
SumOfHoursWorked,
[qryDateFilterTaskHours-Daily].WorkedByWho
FROM ALLTasksFilter LEFT JOIN [qryDateFilterTaskHours-Daily] ON
ALLTasksFilter.ProjectName = [qryDateFilterTaskHours-Daily].ProjectName
GROUP BY ALLTasksFilter.ProjectName,
[qryDateFilterTaskHours-Daily].WorkedByWho;
The Nz function converts null values to a specified value. For
instance, Nz(YourFieldName,0) would report any null values as zero. By
putting this inside your sum function, you are converting the nulls to
zero BEFORE it tries to sum them up. BTW, this works for all data
types, so long as your specified value matches the data type of
YourFieldName. If it is a string field that is null,
Nz(YourFieldName,"Blank") would spit out the word Blank.
HTH,
Jana
GOT IT!
Thank you to all those who have helped me! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Pablo J Royo |
last post by:
Hello:
i have a function that reads a file as an argument and returns a reference
to an object that contains some information obtained from the file: FData
&ReadFile(string FilePath);
But ,...
|
by: Don Vaillancourt |
last post by:
What's going on with Javascript.
At the beginning there was the "undefined" value which represented an
object which really didn't exist then came the null keyword. But
yesterday I stumbled...
|
by: ~TheIcemanCometh~ |
last post by:
I have a textbox field on a report that shows an Address. The field is
built up in code when the user selects the customer in the following
manner:
ShipAddress = CustomerName & vbCR &...
|
by: Anastasios Papadopoulos |
last post by:
Hello all,
I have statements like the following in my Property Get:
Public Property AccountNumber() As String
Get
Return MyClass.AccountNumber.ToString
End Get
blah blah
End Property
|
by: rengeek33 |
last post by:
I am building a SQL statement for Oracle and need one part of it to read:
, myvar = null, myvar2 = "1", myvar3 = "0", myvar4 = null,
etc.
I am constructing this string using the String...
|
by: Jeff |
last post by:
Hey
I've bought the book "ASP.NET 2.0 website programming, Problem, Design,
Solution" and some of its code examples is this code:
protected static string ConvertNullToEmptyString(string input)...
|
by: Micheal |
last post by:
Greetings Access Group,
Being relatively new to Access, I try to work through problems on my own and have been very successful, although I have a conundrum that I have been working on for two days...
|
by: crabsdf |
last post by:
My project is a single method class which takes a xml object and, using Apache FOP, transforms it into a PDF which is returned as an output stream.
Here is full code
package...
|
by: kaka123 |
last post by:
hey, im doing this program and im reading the information from a file, i cant figure out how to get the print out right. Ive looked at all my for loops and i thought the error would be in the...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |