Calculating Field Specific Averages From Records In Separate Tables

Apr 28, 2014

Let's say I have a table sort of like this one: [URL] .... (Table 1)

What I want to do is make another table that references the first table: [URL] ... (Table 2)

I want the cells in the Average field in Table 2 to calculate an average of all the values for records in Table 1 with Color fields that correspond to the Color field in Table 2 (this makes a little more sense if you look at the pictures). I could do this in Excel, but then problems would arise whenever I would add a new entry to the database, or re-alphabetized the data, since Excel math is depends entirely on the positions of cells, and I want these averages to be continually calculated correctly and to change whenever I add related records to the database.

View Replies


ADVERTISEMENT

Calculating Averages

Nov 5, 2006

I have a database containing values in 16 fields. the fields are filled in over a period of three years. I would like to be able to calculate the average of the last four values entered, regardless of when in the cycle the value is required. I have tryed to use quereies but connot find away to assign the four fields to the expression so that it is the last four values and if four don't exist, avearage what values there are.

View 2 Replies View Related

Help With Grouping Items And Calculating Averages

Oct 28, 2007

Simple query for the right person!!!

Hi Guys,

Im in need of some help with a query that i am trying to set up. I have a table with data shown roughly below. And need to extract the average [call length] for each heading of [Call type] on a given date.

Ie. The query will be run and the date can be inputted. It would the display each category only once and the average of that category.

Call type |Call Length (Shown in Minutes)|Submitdate
Split Billing | 4 |27/10/07
Split Billing | 8 |27/10/07
Split Billing | 9 |27/10/07
Split Billing | 1 |27/10/07
Split Billing | 4 |27/10/07
Tariff changes | 2 |27/10/07
Tariff changes | 3 |27/10/07
Tariff changes | 8 |27/10/07
Tariff changes | 5 |27/10/07
Tariff changes | 5 |27/10/07
Billing Cycle | 1 |26/10/07
Billing Cycle | 2 |26/10/07
Billing Cycle | 3 |28/10/07
Billing Cycle | 20 |26/10/07
Billing Cycle | 15 |27/10/07

View 3 Replies View Related

Queries :: Calculating Three Different Rolling Averages In One Query?

Jun 26, 2013

Is there a way to calculate three different rolling averages in one query?

I just inherited a database where someone is using three queries to capture the same information only with different time frames. They were calculating a rolling three month average, six month average, and twelve month average. I would like to combine these queries into one to reduce time spent running reports from the database. All three queries are based on one table. One of the columns in that table is called "Month Start Date". That field shows the first day of the month when a call was entered. I can get the query to tell me the first month in the three month period and the first month in the six month period, but I can't get it to calculate the averages of the calls that fall in those time frames. Here is the SQL for the query I have now. When I try to run this, I get the error message that my formula is not part of an aggregate function.

Code:
SELECT DISTINCT DateAdd('m','-2',(Max([Month Start Date]))) AS ThreeMonthStartDate, DateAdd('m','-5',(Max([Month Start Date]))) AS SixMonthStartDate, Max([Month Start Date]) AS MaxStartDate, IIf([Month Start Date] Between [ThreeMonthStartDate] And [MaxStartDate],Avg([All Call Rate]),' ') AS ThreeMonthAverageCallRate, LIST_WITH_TNC.Device, LIST_WITH_TNC.Model, LIST_WITH_TNC.[Item Num]
FROM LIST_WITH_TNC;

Is there a way to make this work?

View 2 Replies View Related

Calculating Total Prices Only For Specific Records

Mar 22, 2008

Look at this query:

http://i237.photobucket.com/albums/ff304/hankymskdghdfag/qryUvoz.jpg

I wan't to calculate the price totals but for each instance of Uvoz ID separately. I've sucessfully used Dsum function but I managed only to calculate all price totals for all instances of Uvoz ID. Is it possible to do it for each number of Uvoz ID separately? How do I do it?

View 9 Replies View Related

Tables :: Updating Dates In Specific Records Within A Field

Nov 6, 2013

So I currently have a table that tracks medication activity for patients called tblMedRanges. The Fields are the ID, StartMedication, EndMedication, Med ID/Medication Name.

In the End of Medication, some patients are not currently active so they have a set date/time field property. What I have for right now is the default value is set to

Code:
=date()

So that when staff adds a new medication it is set to the current date. These patients are supposed to be active, but it doesn't update the default value. I want it to continue to update to the current date every time the database is open.

I have three options that I know of(or think I know of) to update but can't commit to one in particular :

1)I want these individual records in the field to update the current time for today and was considering using some kind of data macro code using before update.

2)The other idea I had was splitting up the field into an EndOfMedication field that would display a value only if their inactive, and an Active field (text, value list active/inactive choices) that would be used in a query to generate the current date as med field. This would take some crafty query work with comparisons later on to generate list of drugs that they were on for each visit.

3) set to text field and convert the field to date field for comparison in queries.

View 2 Replies View Related

Queries :: Calculating Specific Value In Multi Valued Field?

Dec 31, 2014

have a look on the attached sample database.

How can I get the query to work in order to count specific values per day.

View 5 Replies View Related

Single Data Form Put Data Into Separate Specific Tables

Jan 9, 2012

I am new to Microsoft Access. I have built two entry forms for product release information. I have a drop box under the label customer for each specific customer. I would like for this form to send the data entered in the form to the customer specific table from the customer names in the drop box. I have tried to research and execute this myself thus have been very unsuccessful.

View 14 Replies View Related

Forms :: Use Form To Edit Records In 2 Separate Tables

Apr 2, 2013

I have the logical process, but I just don't know how to put it into code.

I have a form with two boxes HireMovieID and HireCustomerID, with a button HireButton.

The two tables which I have are CustomerInfo and MovieList.

Here's the psuedocode for what I need to happen:

Code:
IF HireMovieID.Genre = "R16"
(IF DOB > Today - 16 years)
Display Error: "Too young"
ELSE Hire()

[Code] ....

I need to somehow make it so that the MovieID is valid, as in, if it doesn't exist then it comes up with an Error MsgBox.

View 4 Replies View Related

General :: 2 Fields From Separate Tables Needed To Create Calculated Field?

Aug 19, 2013

The interface being used is a main form with various tabs and a subform on each of these tabs.

There is one field ('max power density') in my database that is calculated using 'Max Rated Power' and 'Cylinder Capacity' however these are in different tables and subforms. The 'max power density' and 'max rated power' are in table and subform 1 but 'cylinder capacity' is in table and subform 2. Is it possible to keep them in separate tables/subforms and still calculate the field?

View 7 Replies View Related

Tables :: Extract Data From Memo Field And Put Into Separate Fields Of New Table

Jun 15, 2014

I have a notes field in the customer table that is a memo field. An example of one customer's notes field data :

<div>20.3.14 Ordered 2 cartons</div>
<div>4.3.14 Ordered 2 cartons</div>
<div>18.2.14 ordered 1 carton</div>
<div>30.1.14 ordered 3 cartons SCENTED wipes</div>

[Code] ....

I want to extract the date to append to a date field in a "Calls" table and the comment into a text field in the "Calls" table. Is there a way I can do this via query or code?

View 2 Replies View Related

Tables :: Export Table In Excel Workbook With Separate Sheet Based On Value Of Field

Nov 7, 2012

How to export ms access table into excel workbook with separate sheet based on a value of field?

For Example:

I have One Table with three fields

Name Address Company
Steve a Apple
John b Apple
Josh c Dell
Pete d Dell
Pat e HP
Jacob f HP

Output in Excel(list for Employee by company):

Sheet 1 Sheet 2 Sheet 3
Apple Dell HP
Name Address Name Address Name Address
Steve a Josh c Pat e
John b Pete d Jacob f

View 3 Replies View Related

Tables :: Auto Calculating Field In Table

Jul 29, 2015

Currently I have a form with these variables

- Assets
- Shifts
- Machine Offline Date
- Machine Offline Time
- Machine Online Date
- Machine Online Time

In the Asset Table I have recorded on each asset the number of shifts it operates for as well as starting / finishing time of those shift. e.g. 2 shift asset will start at 7:00AM finish at 11:00PM
or 3 shifts asset will start at 7:00AM finish at 6:59AM

Now I have 82 assets in the factory and 20% of those machines run 3 shifts. Each shift is 8 hrs.

What I have already done is allocate shifts per asset e.g.

when I pick Asset (a) in the Asset combo box, in the shift box it will automatically generate 2 or 3 dependant on what I have set.

If an asset runs for 2 shifts, it would mean that, that asset is operational/running from 0700 - 2300 or 7:00am - 11:PM

also if an asset runs for 3 shifts it would mean that, that asset is operational/running from 0700 - 0700 or 7:00AM - 7:00AM

These are the scenarios that is entered through a "Form"

Scenario A: Machine (a) breaks down at 1700/5:00PM on the 10/7/15 and was back online at 12:30 on 11/7/15, This machine runs for 3 shifts which would mean in the "Breakdown Downtime" the result should be 19.5 hrs

Scenario B: Machine (b) breaks down at 1900/7:00PM on the 10/7/15 and was back online at 10:00AM on 12/7/15, this machine runs for 2 shifts which would mean in the "Breakdown Downtime" the result would be 23 hrs.

I would like to make this an automatic calculation, Is this possible?

Please note I am not after a "Query", I need this calculation in the main Database table named "Tbl_MaintenanceDATA".

I understand this is not the norm and many have suggested against this, however for the purpose of what I need, it needs to be in the main table with all the other data.

Here are some snip it
snipit2.png
snipit.png

View 5 Replies View Related

Tables :: How To Add Data To Specific Records

May 6, 2014

i have a table

ID - File Type - Source - Delivery - Return
1 - X - LB - ROY - LB via Roy
2 - Y - USA - Smith - USA via Smith
3 - Z - LB - -

my question is how can i make the last column (Return) to fill like the data above..what i mean if (Delivery) not null So the return will be filled like the above if the (Delivery) is null the return will be null too

-the user will fill only the columns (File Type - Source - Delivery)
-the column (Return) will be filled automatically if (Delivery) not null

View 4 Replies View Related

Tables :: Table For Specific Records Containing Hyperlink ID

May 2, 2015

I am creating a task tracker where the user will enter a task which is working. If he is complete the task at that moment he will submit the task and everything is done for that task. However, if there is some issue or if the user need any information, then the user will enter a comment and will hit hold. My queryis once the user hits hold button, the table "Main" will capture the hold date and time. I need a second table, may be by name "Inbox" which will only show records kept on hold.

Secondly there should be hyperlink for "ID" of Hold records in table "Inbox" and when the user click on the the "ID" to resume the task, it should take the user to "Main" form and display that particular record (record which the user had clicked). Also, the date and time should be recorded when the user click on the hyperlink in Resume_Date and Resume_Time fields for that record.

View 5 Replies View Related

Tables :: Locking Specific Records In A Table

Mar 18, 2014

Is there any way other than through coding/controls I can lock specific records in a table.

I have a reference table with less than 200 records on it. 5 and only 5 records need to be locked so that they primarily can not be deleted but also so they can't be edited.

I've read about locking it at form level but that, to me, means some sort of coding.

View 2 Replies View Related

Help Required Selecting Specific Records From Related Tables

Apr 15, 2008

Hi,

Hope someone can help me out on this one. Searched the forum but can’t find anything to help me out.

I have two tables:
tblCustomers that contains unique customer records (names addresses etc.)
and
tblComments that contains comment data for the customers

Tables are joined one to many tblCustomers -> tblComments on account_ref

tblComments can contain several records per customer, all are datestamped.

I want just the latest datestamped comment record per customer, just can’t seem to work the logic on this one. Must be so simple but can’t fathom it.:confused:

Ideally, I’m producing a report of Customer data (Name, address, contacts etc) + the last comment record for each customer. Have started with a simple query, but have hit an impasse. Have tried sorting, group by, top 1, distinct etc, but don’t seem to be getting anywhere.:mad:

If someone can point me in the right direction, and give me a starter for 10 I’d be much appreciated.

View 1 Replies View Related

Tables :: Updating Specific Records In A Table Using Sql Doesn't Work

Sep 15, 2014

I Have a table that contains the fields: CAT, CHAPTER, ID, someSrting and Completed

CAT, CHAPTER, ID are numbers and Completed is true/false. If I mark a certain entry as Complted (true), I want all the records with the same (CAT, CHAPTER, ID) as the one I marked to be updated to Completed.

For example, If I marked the entry cat:1 chapter:1 id:1 as completed (true), I want all the entrys that have cat:1 chapter:1 id:1 to be marked as completed (true)

the code I wrote is:

Code:
Private Pub Completed_check_AfterUpdate()
Dim myCC
Dim myCat
Dim myChap
Dim myID
myCC = Me.Completed_check
myCat = Me.CAT
myChap = Me.CHAPTER
myID = Me.ID
CurrentDb.Execute "Update [my Table] " _
& "SET Completed = (" & myCC & ") " _
& "WHERE CAT = (" & myCat & ") And CHAPTER = (" & myChap & ") And ID = (" & myID & ") ;"
End Sub

I'm running the code (my clicking the "check box") and nothing happens, I was thinking that maybe I defined the after "WHERE" statement wrong, and there are 0 entrys changed..

UPDATE: after removing the

Code:

"& "WHERE..."

row, the code does update the entire table, so I have a problem with the syntax of the sql..

View 1 Replies View Related

Counting Records With Specific Field Content

Nov 23, 2005

hi there

I'm building a forum from the scrath. It is already working, but I want to have in each topic the number of replies it has.
there are 2 tables, one for the topics and other to the replies. in the replies table there is a field called id_post that has the id of the post witch it belongs.

I solve the problem by inserting a query inside the loop of the posts:

<%
While Not rs.EOF
%>
<%
Set rs2 = Server.CreateObject("ADODB.Recordset")
sql = "SELECT COUNT(*) as cont FROM replies where id_post= " & rs("id") & " "
rs2.Open sql,Conn,1,2
%>

post: <%=rs("post")%> replies:<%=rs2("cont")%>

<%
rs.MoveNext
wend
rs.close%>

but someone told that this would make the page slower, so I want to know if I can do the same thing without having the query inside the loop.

I don't know if I made myself clear, sorry for that.

tks for the help.

View 1 Replies View Related

Calculating % Of A Specific Crosstab Response

Feb 8, 2007

Here's my crosstab report

Answer Name1 Name2 Name3

Yes 90 95 85

No 10 10 35

Total 100 105 120


I need to devide the number of Yes responses for Name1 by the total number of responses. I tried doing it like this =(([Name1]=Yes)/sum([Name1])), but that isn't working.

Thanks in advance,

Dave

View 2 Replies View Related

Forms :: Maps And Locations - Edit Specific Field Records Only

Nov 26, 2014

I want to control the edits of form like if the fields in form are Area, Location, Country, Map, Landline

I want to stop edits on Map and Locations fields once saved yes but user can change rest fields.

View 1 Replies View Related

Queries :: Calculating Days Between Dates From A Specific Record

Dec 14, 2013

I have a query that records a status update, and the date it was made by an employee etc. The table has a secondary key related to ... lets say a project table.

E.g.
Status Id; EmployeeID;ProjectsID;Status;Date

I want to calculate the average amount of days it takes for a status change occur.

View 1 Replies View Related

Tables :: Pound Sign For Specific Items In Notes Field

Jul 11, 2013

I'm having an issue with pound signs in my table for specific items. I've create a DB that when you click a command button it opens a form and in the form it has a notes field. In the notes field once where i had data is now pound signs.

The DB is setup so when you click another command button to close out, it saves the record. It works 98% of the time but the i'm concern about the other 2% of the time.

View 6 Replies View Related

Tables :: Populate Date Based On Specific Text In Another Field

Mar 27, 2013

I would like the "DateOfConfirmation" to populate with today's date when "SSurvDiagThisYear" is Confirmed.

The DateRecordCreated is a simple =Date() that populates when the record is entered into the table.

SSurvDiagThis Year is the case outcome - Pending, Probable, or Confirmed. It is possible that the case could be confirmed on the same day it was entered into the table but that is RARE.

I am hoping for the The DateOfConfirmation to capture the date the case is confirmed so that I can gather some duration between the case being opened to confirmed.

SSurvDiagThisYearDateOfConfirmationDateRecordCreatedIdentificationNoPending12/31/2001269Pending4/1/1999270Confirmed7/29/2001338Pending5/14/2009375Confirmed2/20/2012440Pending3/30/2001543Pending7/1/2000552Confirmed3/30/2001596Pending8/3/2001649Pending6/15/2001672

View 1 Replies View Related

Separate Records By Column

Apr 26, 2006

I have a table set up as the following:

ssn account
01234567 1234567890
01234567 9876543210
01234567 7539514562
98765432 8765432109
98765432 9876541230

and so on...

I would like to create a query that will split the records up like this:

ssn account1 account2 account3
01234567 1234567890 9876543210 7539514562
98765432 8765432109 9876541230

and so on...

It can be in any format, either query or report, I just have to be able to export it into a text file in the same format. Does anyone have any ideas?

Thanks!

Vassago

View 11 Replies View Related

Tables :: Calculated Fields As Data Type In Tables - Calculating Total?

Apr 23, 2013

I am using calculated field as a data type in access 2010.

They are working fine.

However, I added a new field and now the final calc won't work.

I have Subtotal adding loads of fields together. Works fine.

Then I have a VATunit field which is a double integer, so enter 20 and my next field is VATTotal calculates the SubTotal + the VATunit by doing (Subtotal/100)*VATunit. This calculation is fine and gives me the correct amount.

The next field is a Total field. Which adds Subtotal and the VATTotal together. Howver, the Total is the same as Subtotal. It is not adding the VATTotal to it?

View 2 Replies View Related







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