Queries :: Sum Of Values For Items Between Dates

Aug 19, 2015

I am reviewing some old database methods and trying to achieve a text box containing the sum of values for items between two dates. At present it is done using a sub-form based on a query of a query.

At first a query collects the values between dates:

Code:
SELECT tblDespatch.Invoiced, tblOrders.Value
FROM tblOrders INNER JOIN tblDespatch ON tblOrders.ID = tblDespatch.JobDespatchID
WHERE (((tblDespatch.Invoiced) Between (DateAdd("m",-3,Date())) And Date()));

and then a secondary query generates the sum of the values:

Code:
SELECT Sum(qrySWBI03.Value) AS SumOfValue
FROM qrySWBI03;

This actually works perfectly but needs two queries and a sub-form for each bit of information and there twelve of them (quotes, orders and invoices for last 3, 6, 9 and 12 months).

View Replies


ADVERTISEMENT

Queries :: Averages Of Values Based On Dates

Aug 20, 2013

I'm not sure if this is the right forum. If not let me know and I'll move the thread.

Table 1
Date
Measurement A
Measurement B
Measurement C

Table 2
Table 1 ID Link
Data 1

Tables are linked 1-to-many from table 1 to table 2 by ID.

I would like to average the Data1 data per Table1 ID and report it with the Table 1 Measurements.

View 1 Replies View Related

Queries :: Query Filter Based On Dates - Excludes Null Values

Apr 17, 2014

how to return all values in a query when a form critieria is left blank. I have made some progress, the combo box criteria queries were fairly simple, but i'm getting stuck with my date criteria. My query doesn't return null values when I want it to.

I want it to return all records (including null values) if the form OpenFrom and OpenTo dates are blank, and just the values between the selected dates (excluding null values) if the form is completed.

Code:
SELECT qryReportSelector2_Authority.*, qryReportSelector2_Authority.ApplicationDate AS ApplicationDateFilter
FROM qryReportSelector2_Authority
WHERE (((qryReportSelector2_Authority.ApplicationDate) Between Nz([Forms]![frmReportSelector]![OpenFromDate],DMin("[ApplicationDate]","[qryAllCases]")) And Nz([Forms]![frmReportSelector]![OpenToDate],DMax("[ApplicationDate]","[qryAllCases]"))));

View 8 Replies View Related

General :: Entries With Dates - Track Price Changes On Items

Oct 21, 2013

Im trying to create a database so I can Monitor grocery items from different supermarkets in my area.

I have been doing this on Excel for a while now, and its time to do it properly.

The only issue I would have is when I enter data.

I want to be able to track the price changes on items. I have my own.

So for example. Each time i enter the price of an item, I want a time stamp with it. (being the date when i entered the item, should be automatic).

View 4 Replies View Related

Listbox That Passes To Database Values That Are Different From Shown Items?

Sep 11, 2012

I am trying to create a list box that passes to the database a value that is different from what shown in the drop down list. For instance, I want to show the users a drop down list with "Yes" and "No", but then storing into the database "1" when "Yes" is selected and "2" when "No" is selected.

View 1 Replies View Related

Queries :: Calculate Expiry Dates Of Training Courses - Due Dates Not Shown

Aug 28, 2013

I have built a query to calculate the expiry dates of training courses but I am trying to input a criteria so that only dates within 90 days of todays date show. I am using Date()<90 but it doesn't return the correct information. What the criteria should be for this?

View 1 Replies View Related

Queries :: Access 2007 - Select All Dates Between Two Dates?

Apr 9, 2015

I have a table of records, which has within it two date fields (effectively, a 'start' and 'end' date for that particular record)

I now need to create a query to perform a calculation for each date between the 'start' date and the 'end' date

So the first step (as I see it anyway) is to try to create a query which will give me each date between the two reference dates, in the hope that I can then JOIN that onto another query to perform the necessary calculation for each of the returned dates.

Is there a way to do this?

So basically, if for a particular record, the 'start' date is 01-Apr-2015 and the 'end' date is 09-Apr-2015, can I produce a dataset of 9 records as follows :01-Apr-2015

02-Apr-2015
03-Apr-2015
04-Apr-2015
05-Apr-2015
06-Apr-2015
07-Apr-2015
08-Apr-2015
09-Apr-2015

(The *obvious* solution would be to create a separate table of dates, from which I could just SELECT DISTINCT <Date> Between #04/01/2015# And #04/09/2015# - but that seems like a dreadful waste of space, if that table is only required to generate the above? And it would have to cover all possible options; so it would either have to be massive, and contain every possible date - ever! - or maintained, adding new dates as necessary when they are required. Seems horribly inefficient!)

Is it possible to just select each date between the two reference dates? Or can you only query something which exists somewhere in a table?

View 4 Replies View Related

Queries :: Count Dates Between Dates In Two Tables

Jul 8, 2014

I have two tables with dates. Between (!) every two following dates in table1, I want to know the number of dates in table2. How do I write an SQL query for this? The tables I have are up to a few hundred records in table 1 and a few thousand records in table2. So to prevent that this takes hours I need a fast query.

To explain the query I need, for example:
table1
01/01/2014
15/01/2014
17/01/2014
30/01/2014

table2
01/01/2014
02/01/2014
05/01/2014
17/01/2014
18/01/2014
20/01/2014
21/01/2014
25/01/2014

So the answer of the query would be 2,0,4.

Explanation:
Between 01/01/2014 and 15/01/2014 in table 1 there are 2 dates in table2 (01/01/2014 is not included between the dates)
Between 15/01/2014 and 17/01/2014 in table 1 there are 0 dates in table 2
Between 17/01/2014 and 30/01/2014 in table 1 there are 4 dates in table 2

View 2 Replies View Related

Queries :: Totals In Queries - Count Similar Items

Jan 14, 2014

Using Access 2010. Have been using a simple query to count similar items. All of a sudden I cannot get the sum of the count. I don't know if I have done something wrong or my program won't work correctly.

The DB is attached. The only query shown is an example of what I want to total, but I cannot get any total.

View 7 Replies View Related

Help With Dates & Values

Jul 10, 2006

Hi there,
I have a table with a start date and an end date for a leasing database. The lease has an annual fee, but I want to calculate what's that worth for each month of the duration of the lease.

Is this possible through a query? :confused:
I was going to store this data, but having read some of the other posts here, have decided it's not the best option - as I only need these values for reports/queries.

Any help would be greatly appreciated, as I am very rusty on Access at the moment. :(
Thanks,
Mia.

View 3 Replies View Related

Min Max Dates And Values

Nov 30, 2007

I have a query that has InspID, InspDate, NextInspDate, Emissions (calculated by multiplying timeelapsed by associated InspDate Result)


I have another query based off this query that sums the Emissions between two selected dates. This works fine as long as the dates I select are actual InspDates which are random. However if I want a clean sum period (Jan 1, 2007-Dec 31,2007) It only sums the emissions that have an Inspdate after Jan 1. Therefore, if I have an inspection on Dec 28, 2006 and Jan 5, 2007, the query will not count any emisisons for Jan 1-5.

When this happens I need the query to lookup the [result] value of the previous InspDate and multiply it by the [timeelapsed] between the [selecteddate] and the [NextInspDate].

What is the best way to retrieve this information?

Thanks

View 6 Replies View Related

Forms :: How To Get Values From Line Items Form Inserted Into QUOTE LINE

Jun 5, 2014

I have a main form with 3 sub forms. The main form is tied to a table called QUOTES_MASTER. The first sub form is tied to a table called QUOTE_ LINE_ ITEMS_DIRTGLUE. It calculates the subtotal when selecting items. The relationship is one-to-many linked on QUOTE_ID.

The second sub form adds up total of all line items and is not tied to a table.The third sub form adds ESTIMATED FREIGHT to the PRODUCT TOTAL and is not tied to a table. how to get the values from the line items form inserted into the QUOTE_LINE_ITEMS_DIRTGLUE table as they are added.

I also want to insert the total value from ESTIMATED DELIVERED into the LINE_TOTALS field in the table QUOTES_MASTER.I tried this code on the product total sub form but it doesn't do anything and there are no errors:

Private Sub PROD_SUB_AfterUpdate()
DoCmd.RunSQL "UPDATE QUOTE_LINE_ITEMS_DIRTGLUE SET QUOTE_LINE_ITEMS_DIRTGLUE.SUBTOTAL = Me.PROD_SUB WHERE QUOTES_MASTER.QUOTE_ID = " & Me.QUOTE_ID

View 6 Replies View Related

Queries :: Show Items Only Once

Nov 26, 2013

I would like to show all linked components (once) in a query.

With inner joins (option 2 when double clicking on a relationship line), it shows all linked components but with duplicates.

When selecting option 1 (only include rows where the joined field from both tables are equal) I only get 1 row due to the fact that not all components have values in all columns.

Therefore, How to create a query that shows all components that have one or more links to other parts. These links have be checked 3 tables.

I attached a overview of the tables involved.

View 12 Replies View Related

Modules & VBA :: Passing Values Of Selected Items From First Form Until Third Form

Aug 12, 2013

I would like passing values from first form until third form.

In the first form I have a list box after selecting items (For each selected item in first form I have 4 values) and pressing button (or right click of mouse) the second form will be open, then in the second form I have 2 option (inserting, deleting), when I select inserting or deleting in the second form, third form will be open, in the third form there is a "OK" button, when I press that, passed values from first form will be used for inserting or deleting records to the table.

View 4 Replies View Related

Counting Dates And Null Values In Charts

Nov 29, 2007

Hi, I searched the forum for this but the only thread that came close to what I was looking for was this.

http://www.access-programmers.co.uk/forums/showthread.php?t=125240&highlight=null+chart

Basically I have chart in a report thats based on a query that counts the amount of entries per month between two dates inputted by the user.

It all works fine but the chart that is based on the query only shows months that have an entry.

Eg if it counts all dates between the two dates and say the only month that has an entry is July, the chart will only show July. What I want is the other months to show (Null values) as zero, so every month shows. I'm probably missing something basic but can anyone help?

[TextPriDate] is the start date
[TextPriDate2] is the end date

This is the query code (QryDate)
SELECT
tblMain.ID1, tblMain.Dt
FROM
tblMain
WHERE
(((tblMain.Dt) Between [Forms]![frmSwitchboard]![TextPriDate] And [Forms]![frmSwitchboard]![TextPriDate2]));

This the code from the chart in the Report
SELECT
(Format([Dt],"MMM 'YY")) AS Expr1, Count(*) AS [Count]
FROM
QryDate
GROUP BY
(Format([Dt],"MMM 'YY")), (Year([Dt])*12+Month([Dt])-1);

Thanks

View 2 Replies View Related

Update Values On Table 1 Depending On Dates

Sep 19, 2014

What i need:I have the attached database which includes 2 tables (Table1 and Table2) which are related One-2-Many (Table1 is the One and Table2 the Many)There is one form also with the name "Form1" which includes 11 unbound (ctr1,2,3...11) and are calculated with the values of fields [MainDate] , [Days] and [EndDays]

The Issue: As you can see in the attached sample, on Table1 i can assign the "MainDate" value , the "Days" and on field "EndDays" i can have the value of the [MainDate]+[Days].

I need to update the field "RefNo" on Table1 on depending the date range of the field [EndDays] and the controls [ctr1-11]. Specifically i need : If the Date() is in the range of eg. [EndDate] and [ctr1] i need to have the value of the first record of the Table2 (RefNo) on field "RefNo" into Table1. If the Date() is the range of [EndDate] and [ctr2] i need the second record values of the field [RefNo] into Table2 and so over..

View 1 Replies View Related

Queries :: Multiple Items In A Query?

Jan 22, 2015

I have made a database to show me dates that I need to check various documentation from my contractors.

Once a month I want to print out a query/report to tell me what checks need to be made in the following month.

The dates are

Licence Check
Licence Expiry
Van Ins Exp
GIT Expiry
MOT Expiry
Passport Check
Vis Expiry

I need a query table that shows a list of names that have anything to be checked in the month.

So the Column headers would be Name, Surname, Licence Check, Licence Expiry, Van Ins Exp, GIT Expiry, MOT Expiry, Passport Check, Vis Expiry.

Its easy to do a list with one date but when I add multiple dates into the query it looks for names and surnames with the date within the next 30 days for every date and therefor brings back no records.

I have attached the picture. Obviously not all the records will show dates. Some will be blank.

View 14 Replies View Related

Queries :: Combined Probability For Each Of Items

Apr 28, 2014

I have a query which provides probability of occurrences for items A,B,C,D below 5, 10, 15 and 20.

Yet another query gives probability of occurrences for items A,B,C,D above 5,10,15 and 20.

Now I need the combined probability for each of the items A,B,C,D.

What is available and what is needed are both attached.

View 5 Replies View Related

Queries :: Pie Chart - How To Get Count Of Items

Mar 18, 2013

My Data gets one of 4 labels: A, R, N, X. I want a pie chart that shows how many of each I have.

I created a query (StatusCounts) using Group By and Count. It lists "OrderStatus" and CountofOrderStatus.

Whenever I use this query to create a chart I get the default Access data not the data that's actually in that query.

View 1 Replies View Related

Queries :: Invoices With Multiple Items

Jul 7, 2014

I am importing data from a supplier. The table has many invoices included and varying items on each invoice. I need to find a way to separate each invoice with all the included items. For example:

inv# pieces linedesc amount
11 500 nuts $20
11 100 bolts $15
11 75 washers $10
12 150 cameras $75
13 10 desks $150
13 10 lamps $50

View 4 Replies View Related

Queries :: Multiple Items In One Search

Jun 29, 2013

I have an Access database that links one form to one table, so a fairly simple database. The database will average 250k records. How do I query to pull up many (ex. 100) distinct records.

Example - I want to search in a field called 'debtornumber' and want to pull up lots of various account numbers (ex - 0458714 and 0587428 and 0578925 and....). I have hundreds of the individual items to query daily (that I can paste from Notepad or word) and need to pull up all items in the query at one time.

View 14 Replies View Related

Queries :: Search Or Some Items On A Table

Mar 24, 2015

I have made a query to search for some items on a table. I want there to be a button on the search form that says 'search' and takes you to the corresponding page on the form. (The form has multiple pages in, all with different products on) Is this possible?

View 4 Replies View Related

Queries :: Create A Query That Will List All Items

Dec 1, 2014

I have the following tables:

tblOrderDetailsKeyItemIdOrder QtyPO#001A204001002B204001003C304001

tblTransactionsKeyTransDateItemIDReceivedPO#0011/1/2014A1040010021/2/2014B2040010031/3/2014A54001

I also have a table that list the items and on that table the column ItemID is the key.I want to create a query that will list all items ordered on a PO# and how many have been received so far. With that I will calculate the outstanding qty. I want to see:

qryOutstandingPOPO#Item IDOrder QtyReceivedOutstanding4001A201554001B202004001C30030

But all I see is this:

qryOutstandingPOPO#Item IDOrder QtyReceivedOutstanding4001A201554001B20200

It is missing item C because I have not received any yet so there are no records in the Transactions table for it to select.

View 4 Replies View Related

Queries :: Calculation Based On Values Selected In Table By Looking Up Corresponding Values In Other Tables

Aug 29, 2014

I'm using Access 2010. I need to calculate a score based on values selected in a table by looking up corresponding values in other tables. I have a "Project" form to create new entries into the Project table (see Table 1). When I create a new project record, I will select values for the Payback and Need fields by selecting options from a list. The Payback list is pointed at Table 2 and the Need list is pointed at Table 3. In the below example, I created the "ABC" project and selected "1 year" for the Payback field and "Repair" for the Need field. Pretty simple.

Now that I have the "ABC" project loaded to my Project table, I'd like to create a report that will show a "score" for this project. The score should be calculated as follows: Payback Impact + Need Impact. In this example, the score should be 30 (Payback Impact of 20 + Need Impact of 10).

View 5 Replies View Related

Queries :: ORDER BY - Update Values In One Table With The Values In Another Using Join

Sep 18, 2013

I have a query with an INNER JOIN and ORDER BY that is working great. Now, using the same JOIN, I need to update values in one table with the values in another. I thought it would be simple until I learned you can't do an ORDER BY with an UPDATE. Is there another way to achieve the same result? If you remove the 'ORDER BY', the statement below doesn't produce an error but the results are not correct:

UPDATE TableA INNER JOIN TableB ON (Left(TableA.CDN,6))=(TableB.CDN)
SET TableA.HCC = TableB.HCC
WHERE TableB.HCC Like '241*' AND TableB.BBB = 'X' AND TableA.CCC = "1234" AND TableA.HCC IS NOT NULL
ORDER BY TableB.HCC, TableA.CDN;

View 2 Replies View Related

Removed And Returned Items Keep Showing Up In Queries & Reports

Feb 14, 2008

Good afternoon!
I have a database that tracks the withdraws and returns of shared tools.
The withdraw form has a check box on it that is checked to show removed when the item is ordered (this keeps that item from showing up in inventory searches). When the item is returned, that check box is unchecked, showing that the item can be withdrawn again.

When a person withdraws an item their supervisors name is also logged so that we know who to chase down when the item doesn't come back.

I have a query that is supposed to show what items are still outstanding based on a date range (I got the prompt for date range to work..yea me). However, the query shows every time that the item was borrowed.

Example...
I borrow a hammer and my supervisor is Bob. I return the hammer. It does not show as still withdrawn in my query.

The next I borrow the same hammer and again my supervisor is Bob. I return the hammer. It does not show as still withdrawn in my query.

The day after I borrow the same hammer and my supervisor is Joe. I return the hammer. It does not show as still withdrawn in my query.

Some other day I borrow the same hammer and my supervisor is Joe. I do not return the hammer. The two times I borrowed the hammer with my supervisor as Bob show up as well as the other time that I borrwed it with my supervisor as Joe shows up as well as the one that shows I still have it.
. One of the criteria in the query is essentially only show the items that have the check box checked (criteria=true). But that apparently does nothing, or (more than likely), I am doing something wrong.

This is the SQL:

SELECT tblOrder.OrderDate, tblOrder.Supervisor, tblEmployee.EmployeeFirst, tblEmployee.EmployeeLast, tblItemSpecifics.Description, tblItemSpecifics.Serial_Number
FROM (tblEmployee INNER JOIN tblOrder ON tblEmployee.GlobalID = tblOrder.GID) INNER JOIN (tblItemSpecifics INNER JOIN tblOrderInfo ON tblItemSpecifics.Serial_Number = tblOrderInfo.Serial_Number) ON tblOrder.OrderNumber = tblOrderInfo.Order_Number
GROUP BY tblItemSpecifics.Removed, tblOrder.OrderDate, tblOrder.Supervisor, tblEmployee.EmployeeFirst, tblEmployee.EmployeeLast, tblItemSpecifics.Description, tblItemSpecifics.Serial_Number
HAVING (((tblItemSpecifics.Removed)=True));

View 5 Replies View Related







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