Queries :: Calculate Different Timestamp For Matching Criteria

Feb 17, 2015

I have a table that records log entries for equipment and I'm trying to compose a query that calculates the time difference between consecutive timestamps for individual operators but can't quite get it to work out

The table headings are

Fatigue Log ID <----- this is the primary key for the table and is unique

Timestamp

Operator ID

View Replies


ADVERTISEMENT

Queries :: Update Query Using Matching Criteria From 2 Tables

Oct 18, 2013

I have 2 tables that must be involved in this query. Both have the same fields; one is a temporary table created from an Excel import which will be deleted later, the other is the permanent table.

tblStoreProducts is the permanent table. It has a 2-field Unique index; there can only be 1 of any ProductKey for a StoreKey (there can be multiple ProductKeys within a StoreKey, and multiple StoreKeys for each product, but there can only be 1 entry for each unique combination of ProductKey/StoreKey).

tblImportToStoreProducts is the temporary table. It holds all of the ProductKeys for one StoreKey.

My query needs to identify any ProductKey in the tblStoreProducts that does not exist in the tblImportToStoreProducts for that StoreKey, and then it must set the MaxUnits field to 0.

Basically, the temporary table is this years' inventory for a particular store. If a product was in that store last year but it isn't there this year, the quantity must be set to 0 because the ultimate aim is reporting hazardous materials.

View 1 Replies View Related

Queries :: Count Function Which Calculate Data With Date Criteria

Jan 20, 2014

Looking to have a count function which calculate data in sense like if records found on 1-jan-2014 the it give answer as 1, same as records for 2-jan-2014 it should return 2 and so on .. in short the criteria must look and give same number for same dates starting from 1

View 8 Replies View Related

Queries :: Calculate Time Difference And Show Result Under Certain Criteria In Query

Jul 9, 2013

ID Up Time Down Time
John 18:00 15:00
Kelvin 08:00 08:05
Melisa 23:00 02:00

This is the Table , i need the Query result show IF [Up Time]-[Down Time] is >=3 hrs

Like Below :

ID Up Time Down Time
John 18:00 15:00
Melisa 23:00 02:00

IDUp TimeDown TimeJohn18:0015:00Melisa23:0002:00

I tried DateDiff("h",[Up Time],[Down Time]) in Field but POP out with error "Syntax error (comma) in query expression 'Table1.[DateDiff("h",[Up Time],[Down Time])]' " ...

View 9 Replies View Related

Queries :: Include Date Criteria In User Defined Function That Calculate End Of Current Month

Jul 22, 2014

I have written a user defined function that calculates the end of the current month. This I named EndOfThisMonth. It works well as a function. Now I would like to use it as date criteria to include in a query. The function is included as such EndOfThisMonth().

The field on which this function is to enter as a criteria is another calculated date function called Due.

When I run this query I get an error message saying Undefined Function 'EndOfThisMonth' in expression.

View 3 Replies View Related

Number Of Values Matching Criteria Across A Row

Feb 1, 2007

Dear all:

I can't seem to figure this one out on my own; I'm trying to create a query that counts the number of values in fields across a row that match certain criteria. For example, the data I'm querying looks like:


ID 01-1 01-2 02-1 02-2 03-1 03-2 04-1 04-2
1 85 76 68 72 67 63 74 73
2 32 34 70 65 67 80 68 70


and I need to find out, for example, how many numbers for each id are greater than or equal to 70 but less than 80. I've tried using DCount, but it gives me the number overall that match the criteria instead of the number per row (so I'm sure I'm doing it wrong). I've tried using a crosstab query, but I can't suss out how they actually work when you've got more than one column of data that you need to work with unless I put ID as column headers and the other fields as row headers... that would make my query about 1500 columns wide and 10 rows long, though, which just seems wrong... ?

In a slightly different approach, I've done another query on the data that makes it look like:


ID Number First Second
1 01 85 76
1 02 68 72
1 03 67 63
1 04 74 73
2 01 32 34
2 02 70 65
2 03 67 80
2 04 68 70


But again, I keep ending up with silly answers (like the count for the entire set of data, rather than just per ID). I'm *sure* I'm just not quite getting how DCount works... and it's possible I'm trying to use it for something for which it wasn't designed. Any alternative examples would be most helpful.

I'm not sure how to compress the data any further. I could, technically, get it down to two columns (ID and <number to query>), but the only way I can see of doing it is to create a temporary table for the first column and append the second column's data to it, which I'd have to do every time any of the numbers changed.

I would prefer to use the first approach, as that query is useful in other calculations and the second is a bit of a faff (though not too bad, just a union query). Anyway, I'm just stuck and instead of continually banging my head against the wall, I thought I'd ask you kind folk for help. :)

-Jen

View 7 Replies View Related

Forms :: Return All Records Matching A Set Criteria

Dec 3, 2014

I have a form that is bound to a query that returns all records matching a set criteria (namely, the field ApprovalDate is null); the idea is that the user clicks on a command button which gives information, and if the user chooses to continue (vbYes), then the field ApprovalDate has its value set as the current date, and the record is saved.

Next, I have put in DoCmd.Requery to requery the form and effectively go to the next record wanting approval - this appears to work fine, however I need to add something to the code that handles a null return from the requery - preferably a message box and then have the form close.

View 5 Replies View Related

Queries :: Breaking Out (Timestamp And Total Duration) Into 15 Minute Interval?

Dec 20, 2013

I am trying to figure out how to take a table of timestamps and activity duration and break it into intervals, where it groups the duration into the time spent in each 15 minute interval. I have included a sample of the data and output. Is there any way to pull this in Access (or SQL)?

Raw Data
EmployeeActivityTimeStampStartTimeStampEndTotalDuration
Doe,JohnSomeActivity12/16/13 9:06:02 AM12/16/13 9:57:14 AM0:51:12
Smith,JaneOtherActivity12/16/13 9:22:15 AM12/16/13 10:06:55 AM0:44:40

Query to break out the total duration time in to the 15 minute interval it fell into

EmployeeActivityIntervalIntervalDuration
Doe,JohnSomeActivity12/16/13 9:00:00 AM0:08:58
Doe,JohnSomeActivity12/16/13 9:15:00 AM0:15:00
Doe,JohnSomeActivity12/16/13 9:30:00 AM0:15:00
Doe,JohnSomeActivity12/16/13 9:45:00 AM0:12:14
Smith,JaneOtherActivity12/16/13 9:15:00 AM0:07:45
Smith,JaneOtherActivity12/16/13 9:30:00 AM0:15:00
Smith,JaneOtherActivity12/16/13 9:45:00 AM0:15:00
Smith,JaneOtherActivity12/16/13 10:00:00 AM0:06:55

View 2 Replies View Related

Calculate Days Between Dates & Other Criteria

Dec 9, 2007

I have a database with 10-12 fields containing dates certain things were completed. There is also a field for the 3 different locations we have and a program year 2006, 2007, or 2008. What they would like to do is click a button and get a list to choose the first date they which to compare, then a list to choose the second date, calculate the number of days between the two dates, select the program year from a list, and a location from a list. Can anyone help me with how to do this if it's possible?

The fields look something like this:

Prog Year Location DateA Date B DateC DateE
2006 G date date date date
2006 G date date date date
2006 P date date date date
2008 D date date date date
2007 P date date date date

For Example, I might want 2006 Program Year, Location P, calculating days between DateA and DateB, except that the next time I might want to choose a different set of criteria.

Any ideas?

THANK YOU!

View 7 Replies View Related

Queries :: Combining Queries Without Matching ID Values

Feb 2, 2015

I have two queries:

1. a sum of payments by individuals
2. a sum of charges of individuals.

I want to combine these queries to create a report that shows the sums for each person of the charges and payments and calculate the balance. However, it is only showing me those individuals that have both a charge sum and a payment sum, while some individuals will only have a charge sum. How do I get those individuals to show and show with a zero payment balance if they are in my charge sum query but not my payment sum query and vice versa (some may have made a prepayment even though they have not been charged yet).

View 5 Replies View Related

Calculate A Grade Score From Another Table Criteria

Dec 27, 2007

dear all;

i've a table #student like

studentID score

Sminth 88
samantha 76
Williamv 45
martell 78

and i also have a #grade table

Grade Start end

F 0 45
E 46 55
D 56 65
C 66 75
B 76 85
A 86 100

and my question is,how to calculate the student table's grade value?
i want the result like below..
#studentID score Grade
Sminth 88 A
samantha 76 B
Williamv 45 F
martell 78 B

anyone can help me??thanks alot

regards


martell

View 12 Replies View Related

Reports :: Calculate Percentages Based On Criteria In Report?

Oct 22, 2013

I created a database to record time logged per workorder for each employee on my job. Each time log has a specific "Trade" attached to it along with a number of hours the employee spent on that workorder. I've created a report to display how much time the selected employee spent on each workorder (within a date range) and now I want to see what percentage of their time was spent on a particular "Trade" (for instance, during September Employee "name" spent "percentage" of their time on Electric, "percentage" on HVAC, "percentage" on Plumbing...[and so on])

I have trades listed in the table and in the time log, the form writes to the trades area of the table (probably very elementary for this discussion) and the report lists the name and grand totals with percentage of total time on each workorder, but does not list any trade information.

How can I add this into my report, preferably at the end (Report Footer?)

View 4 Replies View Related

General :: Lookup Criteria - Rate To Calculate Salary

Sep 6, 2012

I have one table with employees and positions. Each position has a specific rate which is stored in another table (table2). Since the rates of the positions are changing, I want each time the employee get paid with the correct rate.

The problem is that I do not want to lose historic data since I want the rate to calculate the salary. I thought that the best way is to look up for the rate according to the position and the period that is valid.

I have attached herewith a small example with the two table that I want to use the relationship.

View 3 Replies View Related

Queries :: Sum Of Non Matching Results

Jun 16, 2013

I have a table with sales in (TBL_Sales) as well as another (TBL_Key_Customers) which lists information about specific customers, in particular if they are part of a group e.g I would categorise Dave's Cars, Dave's Bikes and Dave's Coaches as being part of the Dave group.I would like to query the TBL_Sales to see how many sales were made to the Dave group but then also what else was sold. e.g if Factory 1 sold 100 items of which 60 went to Dave's group then the remaining 40 would be shown as "Other".

View 4 Replies View Related

Queries :: Matching Values Without Duplicates

Oct 23, 2013

I'm looking for a way to grab values from one table that match a criteria, and append them/update them to another, but only grab one value once. Example:

Part ID ---- Profile Profile ID ---- Locations
Part1 - Profile 1 Profile 1 ---- Location 1
Part2 - Profile 1 Profile 1 ---- Location 2
Part3 - Profile 1 Profile 1 ---- Location 3

I have a database of parts that fit in certain profile sizes. Each profile size has multiple open locations. I need a query to grab a location, assign it to a part, grab a new location, assign it to the next part, etc, without assigning duplicate locations to different parts.

Right now, I'm doing this by using the First/Last aggregate functions, marking them as used, and looping it again and again until all have unique locations. Is there a better way to do this?

View 8 Replies View Related

Queries :: Only Show If ID Is Matching In Other Table?

Jun 12, 2015

I have two tables. One with a persons name and ID, DOB, GP etc (TblName) and one with the persons ID and medication they take (TblMedication). I have a query that runs a report. The header is made up of the first table (TblName) and the body of the second table (TblMedication). All works fine but it shows all records from the first table (TblName) regardless of whether they have medication or not so the body shows up blank. I want to run the query with both tables information but only show the persons header if they have medication.

View 14 Replies View Related

Queries :: Matching Two Tables With Count

Jan 20, 2014

trying to create a query in which I can select a count across two tables with matching postcodes.

Table 1 : Address database with column called 'STRIPCODE' (e.g. ME8, ME9, ME10)
Table 2 : Area Code table; each column has a list of area codes to match to the STRIPCODE column. (e.g. MEDWAY column will have all of the relevant area codes)

I would pretty much want a count of each match as below :

STRIPCODE
MEDWAY 650
BLACKPOOL 563
HULL 352

Have a few hundred areas to match and tired of going through these manually and entering counts!

View 3 Replies View Related

Queries :: Query Data Not Matching?

Apr 19, 2013

I have a table that holds course information for students. I have a parameter query linked to this prompting the user to enter a course code thus displaying all students who have that course. However, I would like to do the opposite i.e prompt the user to enter a course code and then the result to be a list of students who do not have that course.

View 8 Replies View Related

Queries :: Date Range Matching

Jun 4, 2015

I have two tables. One is about 160 thousand records, which is a part number, a contract price and a day the price took effect. The items appear several times. Prices go up and down over the course of the data, and items are added and dropped.The second table is a list of dated sales and quotes of those items over the past 14 months.(About 10 thousand lines)

I need to match the items with the contract price that existed on the day the quote or the sale was created, so as to demonstrate we were always at or below the contract price.

View 1 Replies View Related

Find Matching Data Between 2 Queries

Aug 23, 2012

I am managing a tool room and one of my tasks is to update a chit board where people sign out their tools. I have managed to make a query to find New Employees and one to find Terminated Employees. I have also made a query to find the matching employees between these two queries.

My problem is that we employ both contractors and direct employees. When a contractor is hired on directly, their name shows up in both the New list and the Terminated list.What I want to do is have a separate query that shows contractors who went direct and not have these employees show up in the other 2 queries.

Both queries are unmatched query that compare the "Current Chit Board" table to the "Weekly Roster Check" table. The first query called "New Employees" displays the data from the "Weekly Roster Check" table where Employee Number from "Current Chit Board" Is Null. The second query called "Terminated Employees" is the exact oposite. The third query I have is called "Contract to Direct" compares the "New Employees" query to the "Terminated Employees" Query with a "fields from both tables are equal" join type.The problem is when I try to do an unmatched between either the New or Terminated Emplyees queries and the Contract to Direct query, I get a Circular Reference warning and it doesn't execute.

View 3 Replies View Related

Queries :: Count Matching Postcode Between Two Tables

Sep 1, 2014

I have two tables, one being an 'Address' file and the other an 'Area' file which is a list columns ranging from 1-400 with groups of district level postcodes. For Example; column 1 will have postcodes such as BN1, BN2, BN3, BN4, BN5 etc. Each column has a separate group of postcodes.

Now, my 'Address' file also has a column within this labelled 'District' in order for me to create a straight join (between column number and District) in a query to count each group individually, but of course, do to this 400 times becomes quite tedious! (to say the least)

I would require the outcome to be as follows :

Area file - Count
1 - 469
2 - 201
3 - 0
4 - 3598
5 - 268
. - 101
. - 8936
. - 563
399 - 287
400 - 41

View 5 Replies View Related

Queries :: Matching Users And Status In Query

Jun 19, 2015

I have a database where there are 3 tables. table "d_cases", table "d_user" and table "d_status"

The table "d_cases" has the users and statuses only with a number. Peter has ID 2, John ID 1. There is status ID 1 that is New, ID 2 Started and so on.

How can I run a query that will show me the names and status instead of the numbers?

I have attached the database (2003 format) ....

View 2 Replies View Related

Queries :: Matching Year Field In 1 Query

Feb 5, 2015

Using Access 07

This is my query

SELECT QrySiteAlloc.Site, QrySiteAlloc.AllocYr, QrySiteAlloc.SiteAllocation, Sum(QryReserveTotals.SumOfAddtlAllocationAmt) AS SumOfSumOfAddtlAllocationAmt
FROM QrySiteAlloc LEFT JOIN QryReserveTotals ON QrySiteAlloc.Site = QryReserveTotals.Site
GROUP BY QrySiteAlloc.Site, QrySiteAlloc.AllocYr, QrySiteAlloc.SiteAllocation;

In the QryReserveTotals is a datereceived field.

I need the year of the date received field to match the QrySiteAlloc.AllocYr that will be selected by a parameter..

what would be the criteria to achieve this?

View 3 Replies View Related

Queries :: Matching Fields From Multiple Columns

Jun 26, 2013

I have a series of numbers in 30 columns. I want to identify where either of two numbers appear in the same record regardless of which of the 30 columns they are in.

OTHCPT2OTHCPT3OTHCPT4OTHCPT5OTHCPT6OTHCPT7
00300C1778C1820J0690 J2250 J2270
00300C1778C1820J0690 J2250 J2270
00300C1778C1820J0690 #NULL!#NULL!
2318095978C176788307J0131 J2270

For instance if 23180 and J2270 are in the same record I want to identify them for all of the records.

View 7 Replies View Related

Queries :: Query That Returns No-matching Records

Jul 15, 2013

Suppose I have two tables with fields as follows:

Assigned Courses (Courses that employees should do)Employee number
Assigned Course Name

Fulfilled Course (Courses that employees have done)Employee number
Fulfilled Course

Now I need to do a query that tells me which employees haven't done. Is there anyway to do that that is not an exclude query?

View 4 Replies View Related

Queries :: Matching Dates By Month And Year

Aug 27, 2013

Looking to match to date fields within a query by using the month and year only, is it possible and how.

I'm using Access 2003

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved