The following code does not ignore the empty field values.It provides the correct values when the fields do contain a time value (ie 10:20:35) - TotalTime3: Format$(Nz(CDate([lap1time]))+Nz(CDate([lap2time]))+Nz(CDate([lap3time]))+Nz(CDate([lap4time])),"hh:nn:ss")
(for illustration purposes i used the first 4 fields only - are actually 8)
Any suggestion on how to ignore empty fields in this query please?
7 3694
You are not using the NZ function correctly. The function is nz(CDate([lap1time]),"Value if Null") .
However, in this case I don't think you need it. If the field values are null then just using the + sign should deal with it. - TotalTime3: Format$(CDate([lap1time])+CDate([lap2time])+CDate([lap3time])+CDate([lap4time]),"hh:nn:ss")
The timefield values are blank as it is generated in a query. I need to use - TotalTime3: Format$(Nz(CDate([lap1time]))+Nz(CDate([lap2time]))+Nz(CDate([lap3time]))+Nz(CDate([lap4time])),"hh:nn:ss")
and incorporate Nz or equivalent to compensate for the blank values. Any suggestions please?
Did you try using 0 for the value is null property? - TotalTime3: Format$(Nz(CDate([lap1time]),0)+Nz(CDate([lap2time]),0)+Nz(CDate([lap3time]),0)+Nz(CDate([lap4time]),0),"hh:nn:ss")
I'm not sure I understand why the + sign on it's own doesn't work though, it should just ignore the null values.
this is so weird!
if i have lap1time to lap4time and no blank spaces, it works 100%
If i have only 3x laptimes and 1 blank space, it gives an error
see pics
You are a victim of NULL Propagation, without using Nz(), if any part of an Expression evaluates to NULL, the entire expression will return NULL as in: - Format$(CDate("00:51:54") + NULL + CDate("00:00:03"), "hh:nn:ss")
Returns:
Any solution you may have in mind?
This sounds like a serious cancer to me!
Here is the Loooooooooooong answer for 5 Laps, I had to leave some fun for you! (LOL). - TotalTime: Format$(IIf(IsNull([LapTime1]),0,CDate([LapTime1]))+IIf(IsNull([LapTime2]),0,CDate([LapTime2]))+IIf(IsNull([LapTime3]),0,CDate([LapTime3]))+IIf(IsNull([LapTime4]),0,CDate([LapTime4]))+IIf(IsNull([LapTime5]),0,CDate([LapTime5])),"hh:nn:ss")
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Harry J. |
last post by:
Hello All;
We are trying to build a table for tracking times on the Physical
Fitness test. Part of the test is the time it takes to swim so many
laps or to run a mile distance.
Access has...
|
by: Grasshopper |
last post by:
Hi,
I am automating Access reports to PDF using PDF Writer 6.0. I've
created a DTS package to run the reports and schedule a job to run this
DTS package. If I PC Anywhere into the server on...
|
by: Lauren Quantrell |
last post by:
I already figured out (the hard way) I need to convert all my date
parameters into USA format before executing my stored procedures where
dates are used as parameters.
(Format(StartDate, "m/d/yyyy...
|
by: Filips Benoit |
last post by:
Dear all,
I have a datefield that sometimes should store hours and minutes too ans use
following format and inputmask.
dd/mm/yyyy hh\:nn
09/09/0000\ 99:99;0;*
Typing date, hour and...
|
by: Tom Becker |
last post by:
Is there a way, from Access, to programmatically click the Send and
Receive button in Outlook?
|
by: Shawn Yates |
last post by:
I have a report that looks up the earliest start time in a query
. Right now it opens up the query and grabs the earliest
start date like it should. This is the working code:
Set rs =...
|
by: Killer42 |
last post by:
Hi all.
I have a query which calculates the difference between two date/time fields. This returns a number which is, of course, useless without formatting (“I couldn’t believe it took...
|
by: Killer42 |
last post by:
Hi all.
Lunch time now, so I can spare a few minutes to throw in a question before my 2 hour meeting.
Can someone show me briefly how, from VBA, to set up a query with columns formatted the way...
|
by: John |
last post by:
Hi
I am using the below code to run a sql on an underlying access table;
insStr = "INSERT INTO ( Action, ,
, Request_Date ) " & _
"VALUES (""Modify Client"", 93, ""Administrator"", Now())"...
|
by: T |
last post by:
--------------------------------------------------------------------------------
I tried this audit trail code, using 2003 and it works great, I try
and use it at work w/97 and it blows up:...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |