473,608 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to ignore an #Error in a query field you are sorting, descending?

547 Contributor
When i try and add up 3 fields in a query and 1 field is blank, i a get #Error.(due to complicated string problems)

This is fine, but now i want to sort the rest of the records that do add up, and then ignore the one in this descending query, that has an empty field preventing it from been added up.See screen capture pics.
I will be happy just to sort those with totals, as an athlete have to finish all 3 days to be in contention for the overall prize.I you finish only 1 or 2 days, you are disqualified anyway and the total time will be ignored.

fields to add up are
Expand|Select|Wrap|Line Numbers
  1. =day1time + day2time + day3time
the following formulas add up but dont ignore the empty spaces. needs to be modified
Expand|Select|Wrap|Line Numbers
  1. TT: Format$(IIf(IsNull([Day1Time]),0,CDate([Day1Time]))+IIf(IsNull([Day2Time]),0,CDate([Day2Time]))+IIf(IsNull([Day3Time]),0,CDate([Day3Time])),"hh:nn:ss")
have also tried:
Expand|Select|Wrap|Line Numbers
  1. TotalTime: Format$(Nz(CDate([Day1time]))+Nz(CDate([Day2time]))+Nz(CDate([Day3time])),"hh:nn:ss")
i get the Day1-3 times using the following formula
Expand|Select|Wrap|Line Numbers
  1. Day1Time: Nz(Format([Day2]-[Day1],"hh:nn:ss")) etc etc
Should i take this query to a form datasheet?
any suggestions
Attached Images
File Type: jpg stagetotaltime_error.jpg (31.6 KB, 310 views)
File Type: jpg stagetotaltime_error2.jpg (51.1 KB, 546 views)
Dec 5 '10 #1
9 6244
orangeCat
83 New Member
You haven't shown how your fields are defined.
Here is a sample using the following data.

Table: PersonTime
Fields:
ID autonumber KEY
FName text
LastName text
Day1Time number long integer
Day2Time number long integer
Day3Time number long integer

My intent would be to store the Times in Seconds
and calculate the results.

The data, including a time of 0, are
1
Joe
Smith
10
78
0 <-----) time recorded

2
Tom
Jones
74
127
60
The query:
Expand|Select|Wrap|Line Numbers
  1. SELECT PersonTimes.id
  2. , PersonTimes.Fname
  3. , PersonTimes.LastName
  4. , PersonTimes.Day1Time
  5. , PersonTimes.Day2Time
  6. , PersonTimes.Day3Time
  7. , Format(CDate([Day1Time]+[Day2Time]+[day3Time])/(60*60*24),"hh:nn:ss") AS TotTime
  8. FROM PersonTimes;
The rationale is to sum the number of seconds in the calculation; convert it to a date by
dividing the total seconds by
(seconds per minute *minutes per hour * hours per day)
to get days and to format as hh:nn:ss
Attached Images
File Type: jpg Bytes_Seconds.jpg (15.3 KB, 217 views)
File Type: jpg Bytes_SeconsQry.jpg (26.0 KB, 417 views)
Dec 5 '10 #2
ADezii
8,834 Recognized Expert Expert
It appears to work well in the following context (Attachment):
Attached Files
File Type: zip Times.zip (13.6 KB, 96 views)
Dec 5 '10 #3
neelsfer
547 Contributor
Let me attach the problem
Attached Files
File Type: zip timesproblem2003.zip (43.2 KB, 81 views)
Dec 6 '10 #4
ADezii
8,834 Recognized Expert Expert
There is no Code attached to the Click() Event of the Command Button, what Query is causing the problem?
Dec 6 '10 #5
neelsfer
547 Contributor
sorry its the conversion to 2003 that did that
Rt_StageTotal1Q
Dec 6 '10 #6
ADezii
8,834 Recognized Expert Expert
I do believe that the problem lies in the [T1T] Calculated Field (RT_StageTotal1Q)in that it explicitly refers to the [Day2Time] and [Day3Time] Calculated Fields directly. I've substituted the Expressions contained within those Referenced Calculated Fields, and I do believe that it solved the problem. I'll post the revised SQL below as well as the Revised Attachment.
Expand|Select|Wrap|Line Numbers
  1. SELECT Format$(IIf(IsNull([Day1Time]),0,CDate([Day1Time]))
  2. +IIf(IsNull([Day2]-[Day1]),0,CDate([Day2]-[Day1]))
  3. +IIf(IsNull([Day3]-[Day2]),0,CDate([Day3]-[Day2])),"hh:nn:ss") AS T1T, 
  4. Nz(Format([Day2]-[Day1],"hh:nn:ss")) AS Day2Time, Cyclist.Name, 
  5. Nz(Format([Day3]-[Day2],"hh:nn:ss")) AS Day3Time, Cyclist.Surname, Cyclist.Gender, RaceEntry.RaceNo, RaceEntry.IDNo, Rt_Stage1TimesQ.Day1Time, Rt_Stage1TimesQ.ShortMultidayName, Rt_Stage1TimesQ.MultidayStart, Rt_Stage1TimesQ.Day1, Rt_Stage2TimesQ.Day2, Rt_Stage3TimesQ.Day3
  6. FROM (((RaceEntry LEFT JOIN Rt_Stage1TimesQ ON RaceEntry.IDNo = Rt_Stage1TimesQ.IDNo) LEFT JOIN Rt_Stage2TimesQ ON RaceEntry.IDNo = Rt_Stage2TimesQ.IDNo) LEFT JOIN Rt_Stage3TimesQ ON RaceEntry.IDNo = Rt_Stage3TimesQ.IDNo) INNER JOIN Cyclist ON RaceEntry.IDNo = Cyclist.IDNo
  7. GROUP BY Nz(Format([Day2]-[Day1],"hh:nn:ss")), Cyclist.Name, Nz(Format([Day3]-[Day2],"hh:nn:ss")), Cyclist.Surname, Cyclist.Gender, RaceEntry.RaceNo, RaceEntry.IDNo, Rt_Stage1TimesQ.Day1Time, Rt_Stage1TimesQ.ShortMultidayName, Rt_Stage1TimesQ.MultidayStart, Rt_Stage1TimesQ.Day1, Rt_Stage2TimesQ.Day2, Rt_Stage3TimesQ.Day3;
Attached Files
File Type: zip timesproblem2003_2.zip (50.8 KB, 90 views)
Dec 6 '10 #7
neelsfer
547 Contributor
Thx mr Adezii; will have a look.
Dec 6 '10 #8
neelsfer
547 Contributor
working 100%; you are star - mr Adezii!!
Dec 6 '10 #9
ADezii
8,834 Recognized Expert Expert
Glad we got it working for you.
Dec 6 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
714
by: DotNetJunkies User | last post by:
I have to deserialize an XML document to objects and then serialize it back to XML to pass to the stored proc. I am attaching partial code. After this , I also have to serialize Here is the XML : <data> <orders> <order> <order_id>0</order_id> <issue_id>4460</issue_id> <action>add</action>
11
2075
by: MLH | last post by:
I have a query field... Description: & "2-tone" When I run it, the output in that field is empty. If I change the name to MyDescription - it works fine. I noticed the query field has a Description property setting. That's what's causing my problem. Just a 'heads-up' to the group letting you know to watch out for it. It took me a long time to recognize the error. I have another
2
1370
by: visionstate | last post by:
Hi there, Is there a way of searching a sub-form (reading from a query) without writing what is exactly contained in the query field. For example if I had a 'Finance Manager' in the query but just wanted to type 'Finance' in the text box to search or 'Admin Manager' in the query and just wanted to search 'Admin' in the text box. How would I do it so when I searched just 'Admin' or 'Finance', 'Admin Manager' and 'Finance Manager' appeared...
1
4739
by: chitara | last post by:
is there any posibility to block mysql port or someting? I am getting "Error ,query failed" during adding any data through the admin panel of that website:-( same softwares(php, mysql and IIS) with the same script woking fine in my local server but in the main webserver its giving the above message. More over couldn't edit the data also over there. Thats why I am asking, is there any posibility............. I don't have permission to...
5
6467
by: jaishu | last post by:
Hi , I am using a form based on a query. The form is locked and the fields are not editable, but when i just tried typing something, the contents on the form didnt change, but when i closed and opened the Form again, it came up with this error "Query must have atleast one destination field", i had been coming across this error several times and could not find a solution, typically i just pasted the query and it would be fine as long as i...
8
1811
by: MLH | last post by:
Sometimes it works and sometimes it crashes. If I want "Today is " & Date$ & "." to appear in a query field, why might it work sometimes and not others? Would I be better to call a FN? Say, something like "Today is " & GetDateString() & "." ??? If 'Yes' - why is that?
4
1846
by: rajtalent | last post by:
hi all, I want to sort the colum when clicks the columnheader using vb.net 2005 .But i receive the following error "Error 1 Overload resolution failed because no accessible 'New' accepts this number of arguments. " and my code is Private Sub ListView1_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles ListView1.ColumnClick If e.Column <> sortColumn Then sortColumn = e.Column...
1
4147
by: padmaneha | last post by:
Select distinct b.contributor, blogaddress,count(b.contentid) RecipeCount,isnull(c.cnt,0) Other from weblogs.dbo.blogentries b left outer join (select contributor , count(*) cnt from weblogs.dbo.blogentries where category='food' and subcategory = 'others' group by contributor) c on b.contributor = c.contributor where category='food' and subcategory<>'others' and destid>0 group by b.contributor,blogaddress,cnt When I execute the above...
11
3244
by: hgreenesmith | last post by:
Hi, I'm working on a select statement to retrieve data, which I know(data exists) is in the MySQL DB. Here is the part I'm working on: function funGetRecipeIngredientsAsTable() { $recipeID = $_SESSION;
2
1982
by: JaketheSnake27 | last post by:
I'm trying to define a field in a query using an expression. Part of that expression involves using public variables. First of all, is it possible to use variables in a query field? And if it is, what is the proper syntax for doing so? Example: (This is in the query design. is a current field in the query. EPEI and DC are the variables I want to use to calculate the LTR.) LTR: +"EPEI"+"DC" (Access doesn't recognize EPEI and DC when I...
0
8071
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8013
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8503
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8164
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8360
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6017
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2482
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1345
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.