Queries :: How To Round Off Times To Nearest Half Hour
May 23, 2014
I am trying to round off times to the nearest half hour. To be clear, I don't want to only round down or only round up. I need the rounding to be to the nearest half hour. I want to do this in the query, not vba. I've attached a picture of the query.
View Replies
ADVERTISEMENT
Apr 23, 2014
I am increasing prices and after increasing I am left with 4 decimal places and am trying to figure out how to run an UPDATE query to round down prices to the nearest 5 cents, examples below:
42.4516 round to $42.45
42.4659 round to $42.45
42.4489 round to $42.40
2.49 round to $2.45
2.46 round to $2.45
2.44 round to $2.40
2.04 round to $2
I am using "Currency" format.
View 10 Replies
View Related
Sep 15, 2014
I have a table of standard Circuit Breaker (CB) sizes. I then calculate a minimum CB size in a query field. I want to use that calculated minimum value to look up the next largest CB size from the table and fill a field in the query with it.
For now, I am going to add a field to the CB size table with the smallest size CB which would be assigned that standard value. I will then use a Dlookup with conditions of greater than "smallest size" and less than "standard size" fields from the CB size table.
I think this will work fine, but there must be a better way.
View 12 Replies
View Related
Sep 2, 2013
I have a timesheet database, which has the exact start time and exact end time. I want to ignore this if it is five minutes either side of the half hour, and display the exact half hour, but otherwise want to round it UP to the nearest fifteen minutes.
For example:
Exact Start: 09:58:23 Displays as: 10:00:00
Exact Start: 09:42:16 Displays as: 09:45:00
Exact Start: 09:02:08 Displays as: 09:00:00
Exact Start: 09:07:01 Displays as: 09:15:00
Exact Start: 09:23:03 Displays as: 09:30:00
Exact Start: 09:33:00 Displays as: 09:30:00
Exact Start: 09:36:04 Displays as: 09:45:00
View 11 Replies
View Related
Oct 4, 2006
I have values for example like, 0.03, 1.14, 1.28 I'd like to round them to the nearest tenth. So resulting values will be as follows:
0.03 = 0.00
1.14 = 1.10
1.28 = 1.30
How do i achieve this? What's the formula?
View 10 Replies
View Related
Feb 13, 2014
How can a I round to the nearest 10 cents
e.g
10.04 = 10.00
10.06 = 10.10
10.28 = 10.30 ........
View 2 Replies
View Related
Aug 1, 2013
I'm trying to create a query that will return the closest matches to what is input. However the closest i have gotten to this working correctly is by using the following criteria.
Like Left([Forms]![TESTTESTTEST]![Text2],1) & "*"
Now obviously this isn't a great solution as it just produces results that match the first number but i need it to display results closest to the number entered into text2.
Basically i am doing this as a designer can search for a gap on a machine where there new project can fit on causing the least amount of disruption. So by entering in the size of there project the query will display jobs of a similar size that are already planned on the machine.
View 1 Replies
View Related
Apr 2, 2013
I need to do a report that takes data from many different tables (like 10).
To do this I have a big query with many LEFT JOIN to link all the tables together. I have made this query last year and it worked well and efficiently until now.
But I have to add something there, and the problem comes with it :
One of the tables is a currency exchange rate table, with the exchange rate of USD to 50 different other currencies and for each day since Jan 1st 2011.
But in this table there are some dates when a currency does not have an exchange rate (example : it was a holiday in that country, so there is no official exchange rate with this currency on that day).
However, I need to have rates even if they are not present in the table.
I need to get the nearest rate, for example if the rate of EUR on 31st December is not available, I can take the one of the 30th, or 29th or January 1st...
Ideally I would like to do the following :
Add a new LEFT JOIN to my already big query that would look like :
LEFT JOIN CurrencyExchangeRate ON ABS(RateDate - Instrument.Date) < 3
But to take only the closest rate.
I tried with a subquery :
LEFT JOIN (SELECT TOP 1 * FROM CurrencyExchangeRate WHERE ForeignCurrency = Instrument.Currency1 AND ABS(RateDate - Instrument.Date) < 3) AS MRate ON MRate.ForeignCurrency = Instrument.Currency1)
But the subquery does not accept Instrument.Currency1 because it is not part of the table CurrencyExchangeRate
I have a solution that should work, it is to search for this rate in a subquery in the select clause instead of doing a left join. But the tables are quite big (hundreds of thousands of entries) and my work machine is not really 'fast' so it would take hours and hours (when I tried I stopped after 3 hours).
I know there is the solution to make a macro to "fill" the missing rates with the rate of the previous day... But I would prefer not to go to this extent.
View 2 Replies
View Related
Aug 6, 2015
I would like to add fields from one table to another based on matching datetime codes.
Most data are in the table 'metadata' (information on sound recordings), and i want to add lat long fields from a large table of GPS points 'gpsData'. Each record in the metadata table has start and end datetime fields - i want to a add lat and long that matches the start time and a lat and long that matches the end time (so four fields to metadata).
My approach has been to try this with two separate select queries (i.e. one for adding the start locations and one for adding the end locations), with the intention of then combining these two outputs in a single table.
When i try a simple select query though I can see that:
a) there are no matching time codes for some records, because although the hh:mm:ss look the same there are differences in the lesser decimal places of the datetime serial numbers. I have tried using the round function on the datetime fields of both tables but this doesn't fix it (I don't understand why not).
b) there are some duplicates because there are sometimes more than one GPS point for each second, and the metadata times are given to second precision (so some metadata records get two entries in the query result).
How can I have the query select the gpsData record with the nearest datetime stamp to that in the metadata table's start time field? The respective field names are UTC and StartUTC. Can i do the same for the end times simultaneously or should i do this separately?
View 14 Replies
View Related
Oct 10, 2014
I know the Round function exists in MSAccess, but what I need is one that will always round up, and never round down!
Easy enough in Excel, but I can't find one in Access?
View 2 Replies
View Related
Mar 27, 2014
I have an expression that sets an AI Buy It Now value that is 125% of AI Value and rounds it, which follows AI Buy It Now: Round(([AI Value]*1.25)/10)*10
I need to add to this expression that I only want this calculation applied if AI Values are greater than 999. But I can't figure out how to add this stipulation to the above expression. I have tried IIF but it is not working.
View 5 Replies
View Related
Feb 20, 2015
I'm trying to get a query to perform a calculation and round the results.
The fields that I am running the calculation and am trying to round are Data Type Number, properties Field size Single and decimal places Auto.
I have tried the built in function described in Allen Browne's site to no avail.
[URL]
I have tried rounding the individual fields and then adding result.
I have also tried rounding the result (as attached).
View 11 Replies
View Related
Feb 25, 2014
I have about ten append queries to group various financial data to one main table.
I have used the round function (iff (Round(Nz([FIN_data]),2)) in the queries to round the original data into 2 decimal places but there is still one or two lines exceeding 2 decimal places.
What is the better approach to have only 2 decimal places for all append data?
View 4 Replies
View Related
Jun 15, 2005
I have a table that archives hour meter readings for my equipment. You sharp folks here helped me set it up and it works great. Thanks! I am at the point now where I want to do some studies and calculations on this data. The first project I’m working on is equipment utilization over a period of time. I have all my calculations figured out, all I need is to pull the proper data out and run it through. And that’s where I’m a little stuck.
My table is just three fields: tblHourMeterArchive = eqnum, readingdate, meterreading. I want to be able to input a StartDate and EndDate and have the query choose the archive date that is nearest to the input date and the meter reading on those dates. For example, I have meterreading dates of 1/9/05, 1/30/05, 6/5/05, and 6/19/05. I input 1/18/05 as the StartDate and 6/16/05 for the EndDate, the query should return the archive dates of 1/9/05 and 6/19/05. How would I go about doing this?
I’ve done some research on “nearest date”, but most of the information has been about doing it in VB and SQL. Can this be done without going into coding? I’m still very much a novice when it comes to VB code. Ultimately, I would like to have this work with a form and calendar controls. I’ve been studying some of the examples and suggestions for the calendars, but I’m not really sure how I would go about setting up a query in code and linking it all together.
As always, any help and/or links to information you could provide would be greatly appreciated.
View 7 Replies
View Related
Jan 11, 2015
On this db, the users input a FROM date and a TO date to apply for leave, and the number of days required is calculated. I was able to get this done, but the problem is if they want leave for only half a day. The term that we usually use is FN and AN. What I want is this: If they choose FN to FN, or AN to AN, we should get .5. If they select FN to AN or AN to FN that is one day. Saturdays, Sundays and certain other days are holidays. On Table2 I have a FROM field and a TO field, but no field for AN/FN (yet). How can we accomplish this?
View 11 Replies
View Related
Nov 22, 2013
I work for a chemical company, over the course of the day there are 2 shifts, one from 07:00 - 19:00 and the other from 19:00 - 07:00. I want to measure the amount of time a piece of equipment has been offline for, and Sum these times for each shift, these pieces of equipment can go offline multiple times per day which is why I need the sum function. The fields I currently have are:
[Date1] : The date at which it went offline
[Time] : The time at which the piece of equipment went offline
[Duration] : The length of time it was offline for
For each day I wish to sum the offline time in two fields called:
[Shift 1]: The previous nights shift (between 7pm the day before and 7am that day).
[Shift 2]: The days shift (between 7am and 7pm that day).
Where to begin but the logic should be something like:
[Shift 1] = Sum of [Duration] For(([Date1]-1 and [Time] between 19:00 and 23:59) And ([Date1] and Time between 00:00 and 07:00))
[Shift 2] = Sum of [Duration] For([Date1] and [Time] between 07:00 and 19:00)
I currently have two tables storing all this data, one containing [Date1], and another containing the breakdown information such as [Duration], [Time] etc. They are linked by the [Date1] relationship. The reason for the first table only having the [Date1] field is because it is a Main Form which contains various sub-forms.
View 3 Replies
View Related
Mar 29, 2014
I am trying to build a query that depending on the value stored in a combo box called SHIFT, either lists all the entries that have been made by our dayshift (07:00-19:00) or our night shift (19:00-07:00)
Each of these components work if I seperate them out
IIf([forms]![FRMFRame74]![SHIFT]=1,Between #07:00:00# And #19:00:00#,Between #19:00:01# And #23:59:59# And Between #00:00:00# And #06:59:59#)
View 2 Replies
View Related
Aug 2, 2007
Can anyone help with this ANNOYING problem?!
The Database Window within Access on my computer seems to have kinda half disappeared under all the toobars at the top of the screen. Each time i open it it seems to have moved further up. The problem is, that because it is underneath the toolbars, I can't click on the window of it to drag it back down! Now, its got so far up that i can't even select any of my tables, forms, queries or reports because i can't see them!
Its SOOO annoying! and i have no idea what to do about it!
Help please.....:confused:
View 3 Replies
View Related
Jun 8, 2006
I have an access database used for recording training events. I was able to calculate the number of days each training event took by using
Datediff("d",[Training Date From],[Training Date To]+1)
I was really chuffed with this until my boss asked what happens when the training only lasts half a day! I added the time to the above fields to make them date/time fields but can't see a way to calculate in half days.
As well as this the other problem is that training could be over a few days. As an example I'd like to be able to input that the training started at 9am on Monday 29th May and ended at 12 noon on Thursday 1st June and get the result of 3.5 days. The full days would all end at 5pm but I wouldn't be recording that, just the total days. I tried changing the datediff function to hours in the hope I could somehow discount the non working hours but that didn't work! I'd ideally like the final result to be in days, ie 0.5, 1 etc. It would always be in whole or half day increments - don't need things to be overly complicated!
Any help will be very gratefully received. I'm definitely not an expert as you can probably tell!! :eek:
View 1 Replies
View Related
Jun 10, 2014
I have a table with 3 fields:
numberFROM, numberTO, Quantity
e.g.:
10, 15, 6
I would execute an append query that will store in another table:
10
11
12
13
14
15
How could I mange it?
View 14 Replies
View Related
Dec 10, 2014
I have a situation where I am using a maketable query to create a table and then I need to use append queries to then add additional records to the created table - some of these are just run once and some multiple times.
if possible, I do not want to hard code the query multiple times i.e.
Code:
DoCmd.OpenQuery "qryCreate_1"
DoCmd.OpenQuery "qryAppend_1"
DoCmd.OpenQuery "qryAppend_1"
DoCmd.OpenQuery "qryAppend_1"
etc
So is there a way I can run the make table query and then get some sort of loop to run the append query a number of times ?
View 4 Replies
View Related
Mar 20, 2015
I have a table [maintable] that holds print records, with the following fields :
id,userlogon,printername,pagecount,color(yes/no),duplex(yes/no),timestamp and papersize.
I want to create a query that will show the following:
Sum of pagecount where papersize like 'a4' and between 2 dates but FOR EACH USERLOGON.The dates will take them from 2 fields in a form so i will use this
"WHERE (((maintable.Timestamp)>=[forms]![reportsform]![frmdate] And (maintable.Timestamp)<DateAdd("d",1,[Forms]![reportsform]![todate])))" and some more..
So i want the query to show,first the userlogon then a field to show sum of a4 then a4 color prints etc..(remember,i want the between 2 dates criteria to be global,to the whole query)
here are all of the criteria fields i want:
1) - papersize=A4
2) - papersize=A4 and Color=True
3) - papersize=A4 and Color=False
4) - papersize=A4 and Duplex=True
5) - papersize=A4 and Duplex=False
6) - papersize=A4 and Color=True and Duplex=True
7) - papersize=A4 and Color=True and Duplex=False
8) - papersize=A4 and Color=False and Duplex=True
9) - papersize=A4 and Color=False and Duplex=False
View 5 Replies
View Related
Oct 18, 2013
Sometimes i have a problem with dynamical queries. For some of these i need to put in the same parameter value two times, before it works. Why this occurs?
View 2 Replies
View Related
Jun 25, 2014
How to filter between times that trays are scanned. I want it to tell me basically how many trays are scanned between 9:00 to 17:00 17:01 to 1:00 and 1:00 to 8:59 but not having any luck. I've been able to get it to show me everything from 1:00 to 8:59 but I've not been able to get anything else to work.
View 6 Replies
View Related
Feb 13, 2014
I have a table with rooms each room have a number of gust. I want to append each room many times equal to the number of gusts.
View 1 Replies
View Related
Oct 24, 2014
I have a query that gives a value in a column either "A","V","L","H","P","S" or blank.
I want to be able to count the amount of occurrences of each letter and hold that number in a column. Is it easy to do?
View 5 Replies
View Related