Query - Divide

Mar 13, 2006

Just wondering, if this is possible and if so how?

I got query results and would like to divide a figure from the number of results shown..

so if 4 results are shown from the query then i would like to divide 100 by 4, and if 5 results showed then divide it by 5?

View Replies


ADVERTISEMENT

How To Divide A Sum Of A Column In A Table By A Value In A Query

Mar 22, 2014

I have a database which contains a table called "orders" that has a field called "quantity" in it. I also have a query called "defective parts supplied" which has a field called "defective parts".How would I use a new query called "% failure/defect rate per supplier" to calculate the following:100 * [defective parts]/[quantity].

View 14 Replies View Related

Queries :: How To Divide Result Of One Select Query By Another

Mar 17, 2013

I'm struggling with the correct syntax for this, but ideally what I want to achieve is:

SELECT (SELECT Count(Status) FROM P_T WHERE 'criteria are met') / (SELECT Count(Status) FROM P_T WHERE 'different criteria are met')

They are both fairly simplistic select statements, so I imagine this is not that difficult to achieve, but I'm not sure how to structure the query.

View 6 Replies View Related

Divide By Zero Error

Sep 12, 2006

How can I avoid a divide by zero error in an MS Access Query?

View 2 Replies View Related

Divide And Store

Mar 17, 2005

Hi hope someone can help,

What I’m trying to do is work out price per quantity, at the mo I have a database that has products and price so lets take paint for an example.

If I have a 5 litre pot of paint and I’m selling it for £10 I would like a field that tells me the price per litre, so what I’m think I need to do is have a field called ”price” and divide it by a second field called “quantity” and output the sum to a third field called “price per litre” which populates the database.

Sadly I haven’t got a clue how to do this with access and if anyone can help it would be much appreciated.

Thanks

View 1 Replies View Related

Divide By 1,000 Like In Excel

Oct 24, 2006

HiIn Excel, I believe you can format a number and automatically divide it by 1,000 without messing up rounding.For example, 10,000.06 after you apply the formatting becomes 10 as in 10k (for some reason accounting people find this easier to look at/work with). However, if you try to sum the value Excel will actually use the decimal figure rather than the number 10.Is there a similar way in Access?

View 2 Replies View Related

Text Box Divide By Zero

Dec 8, 2006

Hi,

I have a text box which contains a formula. When the text box is divided by zero, it appears #ERROR in the text box. I would like it to be invisible when it divided by zero and to be visible when it has a number.

Any ideas?

Thanks,

Le

View 3 Replies View Related

Avoiding Divide By Zero Error

Aug 25, 2005

Hi all.

I have three subforms on my main form. They all display salary details from different sources, and each subform has 2 calculated fields in the form footer to show the average salary and the number of records on which the average has been calculated.

I then have a field on the main form to calculate the average of the averages which works OK unless one of the subforms has null or zero in it, in which case it returns no information.

Can anyone suggest a way of bypassing this divide by zero error? The code I'm using to calculate the average of averages is as follows:

Me!Text44 = ((Me![Frm1 subform].Form!text4 * Me![Frm1subform].Form!Text6) + (Me![Frm2 subform].Form!text4 * Me![Frm2 subform].Form!Text6) + (Me![Frm3 subform].Form!Text6 * Me![Frm3 subform].Form!Text8)) / (Me![Frm1 subform].Form!Text6 + Me![Frm2 subform].Form!Text6 + Me![Frm3 subform].Form!Text8)

Thanks for any help you can provide...

View 3 Replies View Related

Queries :: Divide Each Value By Sum Of Column

Aug 9, 2015

I am trying to divide each unique value in a column by the total column; so sales by total sales.

View 4 Replies View Related

Queries :: How To Divide A Field Value By Its Sum

May 26, 2015

I have an alias named [Net Income]

[URL]...

I want to divide it's value by the sum of its values through another alias [%]. How to do it?

%:=[Net Income]/Sum([Net Income]) Not working

getting an error saying:

"You tried to execute a query that does not include the specified expression 'SR_NO' as part of an aggregate function."

View 4 Replies View Related

General :: How To Divide 1 Record In Multiple Records

Nov 12, 2013

I have an order table

order nr quantity.
100 110

and a pack table

pack quantity
1 1
1 2
...
1 25
2 1...

I want to make a query that returns this :

order nr pack quantity
100 1 25
100 2 25
100 3 25
100 4 25
100 5 10

View 8 Replies View Related

Modules & VBA :: How To Divide / Distribute Books To Boxes

Apr 18, 2015

I have a list that shows how many books we have for each PO No. (Sorted by PO No.) Like below:

LIST 1:

Code:
PO NoTOTAL BOOKS
PO-0001 12
PO-0002 15
PO-0003 26

Now I would like to distribute/divide these different books to boxes and each box gets maximum 10 books. Like below list:

LIST 2:

Code:
BOX NOBOOKSPO NO
0001 BOOK 1~10 PO-0001
0002 BOOK 11~12 PO-0001
0002 BOOK 1~8 PO-0002
0003 BOOK 9~15 PO-0002
0003 BOOK 1~3 PO-0003
0004 BOOK 4~13 PO-0003
0005 BOOK 14~23 PO-0003

Format is not important in the list2, for example in Box 0002 we have book 11~12 means (book 11 of 12 +book 12 of 12) in po-0001

+ book 1 of 15 until book 8 of 15) in po-0002

books have bookno, for example for po-0001 we have 12 different books it means we have bookno (1 of 12) until (12 of 12) for this po no.

How I can produce automatically list 2 from list 1 by query or coding.

View 2 Replies View Related

Queries :: Make All Of Values Divide Correctly?

Jul 31, 2014

Simple division, I thought! I'm dividing a Sum of hours by Pay Periods to determine the average of missing hours for year-to-date. Most of the division works perfectly, and some doesn't and appears to be related to values of 1 or less than one.The formula: [Sum]/[Pay Periods].Sum relates to total missing hours and pay periods are total pay periods for the year so far.What comes out wrong:

1 (hr) / 12 (pay periods) = 8.33, when it should be .0833
0.5 / 12 = 4.166 when it should be .0416

What is right is everything else, starting with 1.5 hrs

1.5 / 12 = 0.125

What do I need to do to make all of the values divide correctly?

View 3 Replies View Related

Queries :: Put Sum Of All Records In Calculated Field And Divide It By Predefined Value

Feb 6, 2014

I want to take the sum of all records 'cost' i.e.
record 1 - 2
record 2 - 4
record 3 - 3

I want to take the sum and put it in a calculated field and use it to divide it by a predefined value 'no of responses.'

So I make the field in the query -> Calcfield: (Sum([cost])/[responses])

I am pretty new to this and i don't understand why this won't work? Is it something to do with the row Group by (total.)

View 3 Replies View Related

General :: Divide Groups By Equal Distribution Of Merit / Talent?

Aug 9, 2013

I am with an educational organisation. Now we need to allocate various fields to students depending upon their merit, where the difference between the average percentages between any two groups cannot be more than 2% and that also implies equal distribution of talent. However, First few have to be given choice of field and also students recommended have to be given choice. The number of fields varies from 2 to 8. . Further the vacancies are also not equal in all fields. E.g. for 100 students to be divided in four fields the vacancies can be 35 for ZZSS, 24 for UYTE, 29 for OIUI and 12 for HGFT.

I need a solution preferably in MS Excel or MS access for the same with nil/ least usage of VBA.

Table examples

Name REg. No. Percentage

Aaa 986544a 89.3%

Bbb 547521j 87.2%

Ddae v44887y 95%

View 8 Replies View Related

Queries :: Divide Profit Over Turnover To Show Margin - Division By Zero Error

Apr 10, 2013

I am running a very simple query that divides profit over turnover to show the margin. I have many queries throughout my database that do this, here is my little formula;

Margin: Round(([profit]/[Turnover])*100,2)

Now, this runs just fine but if I put in a criteria of <10 I get the division by zero error. The reason I am confused is that there are no zeros or error values or even negative values in either of the profit or turnover columns?

Also I have an almost identical query in another database that has a <5 criteria in it and it works a peach.

I have searched but all I am getting is the usual definition of the division by zero error.

View 5 Replies View Related

DLookUp To Divide A Field In One Record By The Same Field In Another Record

Dec 13, 2006

I'm fairly new to setting up Access databases. Been learning a lot. Ran into a snag that I'm hoping you can help me with.

I am using a form to display text labels and running statistics for our jail.

The form, "Complete_Worksheet" gets its data from a query, "qryComplete_Worksheet". Fields that make these up are:

ID (key)
Standard (text)
Outcome Measure (text)
Numerator/Denominator (text)
CalcValue (number)

ID, Standard, Outcome Measure, and Numerator/Denominator are queried from a table, "tblComplete_Worksheet". CalcValue comes from another query, "qryDataSelect". My problem is this:

In the final calculated statistic, some records are numerators and some are denominators. I need one more field, which I have been trying to create as a calculated control on my form which will divide each numerator CalcValue value by the denominator CalcValue value following it. Since these values change constantly as new data is entered into another data table, the calculated control needs to also change with them. I have been attempting to do this using the following expression:

=DLookUp("[CalcValue]","Complete_Worksheet", "[ID]="&"[ID]-1"/[ID]=")

I keep getting a #Error message in the control in form view. When I run the expression in the Immediate window, I get a Compile Error:

Expected: line number or label or statement or end of statement

Any suggestions on how to make this work?

View 9 Replies View Related

Query In Forms Question (printing A Single Selected Query Record From A Form?)

Oct 19, 2004

What is the best way to impliment a query in a form so that the user can view the query records, and have the option to print or save the selected record using command buttons?

I tried subforms but I could not get the command buttons to work in the subform after it went into the form, it wanted to print the entire form instead of the selected record from the subform.

So in a nutshell I have 3-4 queries that are built, and I want to have them show up on my form in a format that the user can scroll through the results and select a single record of the results and then print or save that individual record from the form, if such a thing is possible.

Thanks in advance

Todd

View 1 Replies View Related

Queries :: Join Results Of Unmatched Query With Matched Query To Include Null

Mar 24, 2013

I am trying to do the good 'ol sales report (query) to include customers with no sales.

I have a customers table, account number table, sales table & sales (line) detail table. (all linked in that order)

If I run a query to show customers (in the customer table) with account numbers, that works

An unmatched query to show customer without an account number works (but of course the unmatched account number field isn't shown).

How can I get the two two be shown together with the "unmatched" having a null or 0 for their account number?

I am guessing in principle, the resulting solution can be modified to show customers without sales alongside those with sales?

View 3 Replies View Related

Queries :: Opening Design View Of Append Query Without Timing Out Source Query

Mar 4, 2015

In some cases I create pass-through queries and use these in an Append or Make-table query to bring data locally.

All is well and fine until source data changes and the pass-through query runs too long and times out.

If needed, I can extend the timeout value in the Parameters of the pass-through query no problem, but when I try to open the Append or Make-table query in Design view to do the same, the pass-through query is first triggered and then throws the timeout, and I cannot access the Design view of the Append or Make-table

Is there a way to open an Append or Make-table query in Design view without invoking the source query?

View 1 Replies View Related

UNION Query MS Jet Database Engine Cannot Find The Input Table Or Query.

Oct 28, 2005

Hello All,

I'm trying to run a UNION query that joins five queries through a MS WorkSpace into a DAO.recordset in VB. I'm pulling the data from a SQL Server Database through VB in Access. I'm attempting to open a recordset with a query passed to it as a string. The query is below. For some reason, I'm receiving a message: "MS Jet database engine cannot find the input table or query. Runtime Error 3078".

Here's what's puzzling. When I run a single query without any UNION statement, the code finds the table and runs fine without error, but anytime I join two or more queries with a UNION statement in the VB, it gives me the error.

I've executed the same UNION query in both Access Query Builder and SQL Server's Query Analyzer and they work fine in both environments. It's only when I call the query from a DAO.Recodset with VB that it causes this problem. The following is a sample of the UNION query joining two of the five queries. Does anyone have any idea what could be the problem? The following query executes in about 5 seconds so I don't think there's a "time-out" issue. I'm thinking that the UNION statement may be the culprit. Maybe there's another way to approach joining these separate queries? Any help would be most appreciated. Thanks.

SELECT SalespersonID, Sum([SlsPrice]-[RtnPrice]-[SlsDiscnt]+[RtnDiscnt]) AS fldPrice FROM MyTable WHERE (((Source)='d') AND ((DistrictID)='01') AND ((CategoryID) = 'HCPROD') AND ((BrandID)<>'CSS')) AND (((BrandID)<>'1356')) AND (((BrandID)<>'1400')) AND (((BrandID)<>'1551')) AND (((BrandID)<>'555')) AND (((BrandID)<>'66'))
AND (TransDate >= 07/01/2005) AND (TransDate <= 07/31/2005) GROUP BY SalespersonID
UNION
SELECT SalespersonID, Sum([SlsPrice]-[RtnPrice]-[SlsDiscnt]+[RtnDiscnt]) AS fldPrice FROM MyTable WHERE (((Source)='d') AND ((DistrictID)='01') AND ((ProductID) = '0029800')) AND (TransDate >= 07/01/2005) AND (TransDate <= 07/31/2005) GROUP BY SalespersonID

Set wrkJet = CreateWorkspace("", "pw", "", dbUseJet)
Set db = wrkJet.OpenDatabase("DW", _
dbDriverNoPrompt, True, _
"ODBC;DATABASE=DW;DSN=DW2")
'Set rs1 = db.OpenRecordset(strSQL)

View 9 Replies View Related

Queries :: Export Query To Excel Then Delete Query Data From Table

Nov 20, 2013

I am wondering if there is a quicker way to export a query to excel then have the data in that query removed from the original table. (effectively cutting the data from the table and exporting to excel)

I understand that this can be done by exporting the query to excel then running the same query as a delete query to remove the data but I just wondered if this is the most efficient way.

I have experience of VB in excel but currently only use the basic macro builder in Access though if Access VB is more efficient I can easily learn.

View 5 Replies View Related

Queries :: Update A Query Based On Results From Another Query Using Count Function

Apr 2, 2013

I run a physical therapy office and patients come in for treatment either 3, 4 or 5 times per week. My database is used to track these frequencies (among other things).

I have 3 queries which count how many patients come in 5, 4 and 3 times/week.

In my main table I have fields called "how many 5's", "how many 4's" and "how many 3's".

I have tried to design an update query which will update those fileds in my main table to reflect the counts in the 3 queries mentioned above.

(I'm not using SQL view, I'm using the query design view)

In the "update to:" row, I use the Build function and locate the count I'm looking for.

Problem: when I run the query I get the error: Operation must use an updateable query.

View 3 Replies View Related

Queries :: Crsosstab Query Doesn't Recognize Expression In Source Query

Aug 12, 2015

I have a query where these are the fields:

ProductRevType
RevLag
RevFlowThru
CloseMoYr
ProjRevDate
CurrentMRC
ProjRevMRC

The ProjRevMRC field is an expression that reads:ProjRevMRC: IIf([ProjRevDate]>=DateSerial(Year(Date()),Month(Date()),1),[CurrentMRC]*[qry303a_ SFADetailMRC_ONLY]![Rev Flow Through],0)

When I run the query, it works perfectly, but when I created a crosstab query to show totals by month, I wanted the totals to be zero for the months less than the current month. Is there a way for the crosstab query to execute the expression and put zeroes for those months?

View 4 Replies View Related

Queries :: How To Insert A Prompt For Number In A Query To Calculate Against Another Field In Query

Jul 15, 2014

I have a field that is giving me the number of business days between a period of time and then I want to subtract that number - the person's PTO time to see the actual days they were available...when I simply type the number in (see below) it works great but I want to set up a prompt that will ask me how many PTO Days to calculate as it will be different for each person I am quering...is this possible?

View 9 Replies View Related

Forms :: Update Form / Query Without Updating Underlying Tables To Query

Jul 23, 2015

I have a form which will be used as the basis to print a label.

It is bound to a query and when I open the form I pass over a 'where' condition to return 1 record. I then use the query to produce a report/label.

What I want to do is to update the form/query without updating the underlying tables to the query.

View 14 Replies View Related







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